Class: SuperDiff::Core::AbstractOperationTree
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of AbstractOperationTree.
19
20
21
|
# File 'lib/super_diff/core/abstract_operation_tree.rb', line 19
def initialize(operations)
@operations = operations
end
|
Class Method Details
.applies_to? ⇒ Boolean
8
9
10
|
# File 'lib/super_diff/core/abstract_operation_tree.rb', line 8
def self.applies_to?(*)
unimplemented_class_method!
end
|
Instance Method Details
#==(other) ⇒ Object
51
52
53
|
# File 'lib/super_diff/core/abstract_operation_tree.rb', line 51
def ==(other)
other.is_a?(self.class) && other.to_a == to_a
end
|
#flatten(indentation_level:) ⇒ Object
29
30
31
32
33
34
|
# File 'lib/super_diff/core/abstract_operation_tree.rb', line 29
def flatten(indentation_level:)
operation_tree_flattener_class.call(
self,
indentation_level: indentation_level
)
end
|
#perhaps_elide(tiered_lines) ⇒ Object
43
44
45
46
47
48
49
|
# File 'lib/super_diff/core/abstract_operation_tree.rb', line 43
def perhaps_elide(tiered_lines)
if SuperDiff.configuration.diff_elision_enabled?
TieredLinesElider.call(tiered_lines)
else
tiered_lines
end
end
|
#pretty_print(pp) ⇒ Object
36
37
38
39
40
41
|
# File 'lib/super_diff/core/abstract_operation_tree.rb', line 36
def pretty_print(pp)
pp.group(1, "#<#{self.class.name} [", ']>') do
pp.breakable
pp.seplist(self) { |value| pp.pp value }
end
end
|
#to_diff(indentation_level:) ⇒ Object
23
24
25
26
27
|
# File 'lib/super_diff/core/abstract_operation_tree.rb', line 23
def to_diff(indentation_level:)
TieredLinesFormatter.call(
perhaps_elide(flatten(indentation_level: indentation_level))
)
end
|