Class: Mxrb::Compare::Comparator

Inherits:
Object
  • Object
show all
Defined in:
lib/mxrb/compare.rb

Instance Method Summary collapse

Constructor Details

#initialize(left_path, right_path) ⇒ Comparator

Returns a new instance of Comparator.



21
22
23
24
# File 'lib/mxrb/compare.rb', line 21

def initialize(left_path, right_path)
  @left_path = left_path
  @right_path = right_path
end

Instance Method Details

#compareObject



26
27
28
29
30
31
32
33
34
# File 'lib/mxrb/compare.rb', line 26

def compare
  left = snapshot(@left_path)
  right = snapshot(@right_path)
  changes = diff_values(left, right)
  Result.new(
    differences: changes.map { format_change(_1) }.freeze,
    changes: changes.freeze
  )
end