class SuperDiff::OperationTrees::Base

Attributes

operations[R]

Public Class Methods

applies_to?(*) click to toggle source
# File lib/super_diff/operation_trees/base.rb, line 6
def self.applies_to?(*)
  unimplemented_class_method!
end
new(operations) click to toggle source
# File lib/super_diff/operation_trees/base.rb, line 17
def initialize(operations)
  @operations = operations
end

Public Instance Methods

flatten(indentation_level:) click to toggle source
# File lib/super_diff/operation_trees/base.rb, line 27
def flatten(indentation_level:)
  operation_tree_flattener_class.call(
    self,
    indentation_level: indentation_level,
  )
end
perhaps_elide(tiered_lines) click to toggle source
# File lib/super_diff/operation_trees/base.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) click to toggle source
# File lib/super_diff/operation_trees/base.rb, line 34
def pretty_print(pp)
  pp.group(1, "#<#{self.class.name} [", "]>") do
    pp.breakable
    pp.seplist(self) do |value|
      pp.pp value
    end
  end
end
to_diff(indentation_level:) click to toggle source
# File lib/super_diff/operation_trees/base.rb, line 21
def to_diff(indentation_level:)
  TieredLinesFormatter.call(
    perhaps_elide(flatten(indentation_level: indentation_level)),
  )
end