Class: SuperDiff::Basic::OperationTreeBuilders::MultilineString

Inherits:
Core::AbstractOperationTreeBuilder show all
Defined in:
lib/super_diff/basic/operation_tree_builders/multiline_string.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Core::AbstractOperationTreeBuilder

#call

Constructor Details

#initialize(*args) ⇒ MultilineString

Returns a new instance of MultilineString.



14
15
16
17
18
19
20
21
22
# File 'lib/super_diff/basic/operation_tree_builders/multiline_string.rb', line 14

def initialize(*args)
  super

  @original_expected = @expected
  @original_actual = @actual
  @expected = split_into_lines(@expected)
  @actual = split_into_lines(@actual)
  @sequence_matcher = PatienceDiff::SequenceMatcher.new
end

Class Method Details

.applies_to?(expected, actual) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/super_diff/basic/operation_tree_builders/multiline_string.rb', line 9

def self.applies_to?(expected, actual)
  expected.is_a?(::String) && actual.is_a?(::String) &&
    (expected.include?("\n") || actual.include?("\n"))
end