Class: SuperDiff::OperationTreeBuilders::MultilineString

Inherits:
Base
  • Object
show all
Defined in:
lib/super_diff/operation_tree_builders/multiline_string.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#call

Constructor Details

#initialize(*args) ⇒ MultilineString

Returns a new instance of MultilineString.



9
10
11
12
13
14
15
16
17
# File 'lib/super_diff/operation_tree_builders/multiline_string.rb', line 9

def initialize(*args)
  super(*args)

  @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)


4
5
6
7
# File 'lib/super_diff/operation_tree_builders/multiline_string.rb', line 4

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