Skip to content

Commit

Permalink
Convert {single,multi}_line to {single,multi}line where appropriate
Browse files Browse the repository at this point in the history
* When "single line" is used as adjective, spell it as `singleline`. Same
  for "multi line".
* When "single line" is used as a noun, spell it as `single_line`. Same
  for "multi line".
  • Loading branch information
mcmire committed Sep 10, 2019
1 parent 7d9836b commit 122115f
Show file tree
Hide file tree
Showing 26 changed files with 148 additions and 148 deletions.
4 changes: 2 additions & 2 deletions lib/super_diff/diff_formatters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ module DiffFormatters
autoload :Base, "super_diff/diff_formatters/base"
autoload :Collection, "super_diff/diff_formatters/collection"
autoload :Hash, "super_diff/diff_formatters/hash"
autoload :MultiLineString, "super_diff/diff_formatters/multi_line_string"
autoload :MultilineString, "super_diff/diff_formatters/multiline_string"
autoload :Object, "super_diff/diff_formatters/object"

DEFAULTS = [Array, Hash, MultiLineString].freeze
DEFAULTS = [Array, Hash, MultilineString].freeze
end
end
2 changes: 1 addition & 1 deletion lib/super_diff/diff_formatters/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def contents
def build_chunk(value, prefix:, icon:)
inspection = ObjectInspection.inspect(
value,
single_line: false,
as_single_line: false,
)

inspection.split("\n").
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module SuperDiff
module DiffFormatters
class MultiLineString < Base
class MultilineString < Base
def self.applies_to?(operations)
operations.is_a?(OperationSequences::MultiLineString)
operations.is_a?(OperationSequences::MultilineString)
end

def call
Expand Down
4 changes: 2 additions & 2 deletions lib/super_diff/differs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ module Differs
autoload :Array, "super_diff/differs/array"
autoload :Empty, "super_diff/differs/empty"
autoload :Hash, "super_diff/differs/hash"
autoload :MultiLineString, "super_diff/differs/multi_line_string"
autoload :MultilineString, "super_diff/differs/multiline_string"
autoload :Object, "super_diff/differs/object"

DEFAULTS = [Array, Hash, MultiLineString, Object, Empty].freeze
DEFAULTS = [Array, Hash, MultilineString, Object, Empty].freeze
end
end
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module SuperDiff
module Differs
class MultiLineString < Base
class MultilineString < Base
def self.applies_to?(expected, actual)
expected.is_a?(::String) && actual.is_a?(::String) &&
(expected.include?("\n") || actual.include?("\n"))
end

def call
DiffFormatters::MultiLineString.call(
DiffFormatters::MultilineString.call(
operations,
indent_level: indent_level,
)
Expand All @@ -16,7 +16,7 @@ def call
private

def operations
OperationalSequencers::MultiLineString.call(
OperationalSequencers::MultilineString.call(
expected: expected,
actual: actual,
extra_operational_sequencer_classes: extra_operational_sequencer_classes,
Expand Down
10 changes: 5 additions & 5 deletions lib/super_diff/equality_matchers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ module EqualityMatchers
autoload :Array, "super_diff/equality_matchers/array"
autoload :Base, "super_diff/equality_matchers/base"
autoload :Hash, "super_diff/equality_matchers/hash"
autoload :MultiLineString, "super_diff/equality_matchers/multi_line_string"
autoload :MultilineString, "super_diff/equality_matchers/multiline_string"
autoload :Object, "super_diff/equality_matchers/object"
autoload :Primitive, "super_diff/equality_matchers/primitive"
autoload(
:SingleLineString,
"super_diff/equality_matchers/single_line_string",
:SinglelineString,
"super_diff/equality_matchers/singleline_string",
)

DEFAULTS = [
Array,
Hash,
MultiLineString,
SingleLineString,
MultilineString,
SinglelineString,
Object,
Primitive,
].freeze
Expand Down
4 changes: 2 additions & 2 deletions lib/super_diff/equality_matchers/array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ def fail
Helpers.style(
:deleted,
"Expected: " +
ObjectInspection.inspect(expected, single_line: true),
ObjectInspection.inspect(expected, as_single_line: true),
)
}
#{
Helpers.style(
:inserted,
" Actual: " +
ObjectInspection.inspect(actual, single_line: true),
ObjectInspection.inspect(actual, as_single_line: true),
)
}
Expand Down
4 changes: 2 additions & 2 deletions lib/super_diff/equality_matchers/hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ def fail
Helpers.style(
:deleted,
"Expected: " +
ObjectInspection.inspect(expected, single_line: true),
ObjectInspection.inspect(expected, as_single_line: true),
)
}
#{
Helpers.style(
:inserted,
" Actual: " +
ObjectInspection.inspect(actual, single_line: true),
ObjectInspection.inspect(actual, as_single_line: true),
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module SuperDiff
module EqualityMatchers
class MultiLineString < Base
class MultilineString < Base
def self.applies_to?(value)
value.is_a?(::String) && value.include?("\n")
end
Expand All @@ -14,14 +14,14 @@ def fail
Helpers.style(
:deleted,
"Expected: " +
ObjectInspection.inspect(expected, single_line: true),
ObjectInspection.inspect(expected, as_single_line: true),
)
}
#{
Helpers.style(
:inserted,
" Actual: " +
ObjectInspection.inspect(actual, single_line: true),
ObjectInspection.inspect(actual, as_single_line: true),
)
}
Expand All @@ -34,7 +34,7 @@ def fail
private

def diff
Differs::MultiLineString.call(
Differs::MultilineString.call(
expected,
actual,
indent_level: 0,
Expand Down
4 changes: 2 additions & 2 deletions lib/super_diff/equality_matchers/object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ def fail
Helpers.style(
:deleted,
"Expected: " +
ObjectInspection.inspect(expected, single_line: true),
ObjectInspection.inspect(expected, as_single_line: true),
)
}
#{
Helpers.style(
:inserted,
" Actual: " +
ObjectInspection.inspect(actual, single_line: true),
ObjectInspection.inspect(actual, as_single_line: true),
)
}
Expand Down
4 changes: 2 additions & 2 deletions lib/super_diff/equality_matchers/primitive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ def fail
Helpers.style(
:deleted,
"Expected: " +
ObjectInspection.inspect(expected, single_line: true),
ObjectInspection.inspect(expected, as_single_line: true),
)
}
#{
Helpers.style(
:inserted,
" Actual: " +
ObjectInspection.inspect(actual, single_line: true),
ObjectInspection.inspect(actual, as_single_line: true),
)
}
OUTPUT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module SuperDiff
module EqualityMatchers
class SingleLineString < Base
class SinglelineString < Base
def self.applies_to?(value)
value.class == ::String
end
Expand All @@ -13,14 +13,14 @@ def fail
Helpers.style(
:deleted,
"Expected: " +
ObjectInspection.inspect(expected, single_line: true),
ObjectInspection.inspect(expected, as_single_line: true),
)
}
#{
Helpers.style(
:inserted,
" Actual: " +
ObjectInspection.inspect(actual, single_line: true),
ObjectInspection.inspect(actual, as_single_line: true),
)
}
OUTPUT
Expand Down
4 changes: 2 additions & 2 deletions lib/super_diff/object_inspection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ class << self
attr_accessor :inspector_finder
end

def self.inspect(object, single_line:, indent_level: 0)
def self.inspect(object, as_single_line:, indent_level: 0)
inspector_finder.call(object).evaluate(
object,
single_line: single_line,
as_single_line: as_single_line,
indent_level: indent_level,
)
end
Expand Down
12 changes: 6 additions & 6 deletions lib/super_diff/object_inspection/inspection_tree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ def before_each_callbacks
@_before_each_callbacks ||= Hash.new { |h, k| h[k] = [] }
end

def evaluate(object, single_line:, indent_level:)
def evaluate(object, as_single_line:, indent_level:)
nodes.reduce("") do |str, node|
str << node.evaluate(
object,
single_line: single_line,
as_single_line: as_single_line,
indent_level: indent_level,
)
end
Expand Down Expand Up @@ -128,13 +128,13 @@ def build_node(type, *args, &block)
class BlockArgument
attr_reader :object

def initialize(object:, single_line:)
def initialize(object:, as_single_line:)
@object = object
@single_line = single_line
@as_single_line = as_single_line
end

def single_line?
@single_line
def as_single_line?
@as_single_line
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/super_diff/object_inspection/nodes/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def type
end

# rubocop:disable Lint/UnusedMethodArgument
def evaluate(object, indent_level:, single_line:)
def evaluate(object, indent_level:, as_single_line:)
# rubocop:enable Lint/UnusedMethodArgument
raise NotImplementedError.new(
"Your node must provide an #evaluate method. " +
Expand Down Expand Up @@ -71,13 +71,13 @@ def pretty_print_variables
end
end

def evaluate_in_subtree(object, indent_level:, single_line:)
def evaluate_in_subtree(object, indent_level:, as_single_line:)
subtree = InspectionTree.new
subtree.evaluate_block(object, &block)
subtree.evaluate(
object,
indent_level: indent_level,
single_line: single_line,
as_single_line: as_single_line,
)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/super_diff/object_inspection/nodes/break.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module SuperDiff
module ObjectInspection
module Nodes
class Break < Base
def evaluate(_object, indent_level:, single_line:)
if single_line
def evaluate(_object, indent_level:, as_single_line:)
if as_single_line
immediate_value.to_s
else
"\n#{" " * indent_level}"
Expand Down
4 changes: 2 additions & 2 deletions lib/super_diff/object_inspection/nodes/inspection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ module SuperDiff
module ObjectInspection
module Nodes
class Inspection < Base
def evaluate(_object, indent_level:, single_line:)
def evaluate(_object, indent_level:, as_single_line:)
SuperDiff::ObjectInspection.inspect(
immediate_value,
indent_level: indent_level,
single_line: single_line,
as_single_line: as_single_line,
)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/super_diff/object_inspection/nodes/nesting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ module SuperDiff
module ObjectInspection
module Nodes
class Nesting < Base
def evaluate(object, indent_level:, single_line:)
def evaluate(object, indent_level:, as_single_line:)
evaluate_in_subtree(
object,
indent_level: indent_level + 1,
single_line: single_line,
as_single_line: as_single_line,
&block
)
end
Expand Down
6 changes: 3 additions & 3 deletions lib/super_diff/object_inspection/nodes/when_multiline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ module SuperDiff
module ObjectInspection
module Nodes
class WhenMultiline < Base
def evaluate(object, indent_level:, single_line:)
if single_line
def evaluate(object, indent_level:, as_single_line:)
if as_single_line
""
elsif block
evaluate_in_subtree(
object,
indent_level: indent_level,
single_line: single_line,
as_single_line: as_single_line,
&block
)
else
Expand Down
6 changes: 3 additions & 3 deletions lib/super_diff/object_inspection/nodes/when_singleline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ module SuperDiff
module ObjectInspection
module Nodes
class WhenSingleline < Base
def evaluate(object, indent_level:, single_line:)
if single_line
def evaluate(object, indent_level:, as_single_line:)
if as_single_line
if immediate_value
immediate_value
else
evaluate_in_subtree(
object,
indent_level: indent_level,
single_line: single_line,
as_single_line: as_single_line,
&block
)
end
Expand Down
4 changes: 2 additions & 2 deletions lib/super_diff/operational_sequencers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module OperationalSequencers
autoload :Base, "super_diff/operational_sequencers/base"
autoload :Hash, "super_diff/operational_sequencers/hash"
autoload(
:MultiLineString,
"super_diff/operational_sequencers/multi_line_string",
:MultilineString,
"super_diff/operational_sequencers/multiline_string",
)
autoload :Object, "super_diff/operational_sequencers/object"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module SuperDiff
module OperationalSequencers
class MultiLineString < Base
class MultilineString < Base
def self.applies_to?(expected, actual)
expected.is_a?(::String) && actual.is_a?(::String) &&
(expected.include?("\n") || actual.include?("\n"))
Expand Down
2 changes: 1 addition & 1 deletion lib/super_diff/rspec/failure_message_builders/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def call(negated:)
end

def matcher_description
Csi.decolorize(expected_section.to_s(singleline: true))
Csi.decolorize(expected_section.to_s(as_single_line: true))
end

protected
Expand Down
Loading

0 comments on commit 122115f

Please sign in to comment.