Class: HashDiff::Comparison
- Inherits:
-
Object
- Object
- HashDiff::Comparison
- Defined in:
- lib/hash_diff/comparison.rb
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
Instance Method Summary collapse
- #diff ⇒ Object
-
#initialize(left, right) ⇒ Comparison
constructor
A new instance of Comparison.
- #left_diff ⇒ Object
- #right_diff ⇒ Object
Constructor Details
#initialize(left, right) ⇒ Comparison
Returns a new instance of Comparison.
3 4 5 6 |
# File 'lib/hash_diff/comparison.rb', line 3 def initialize(left, right) @left = left @right = right end |
Instance Attribute Details
#left ⇒ Object (readonly)
Returns the value of attribute left.
8 9 10 |
# File 'lib/hash_diff/comparison.rb', line 8 def left @left end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
8 9 10 |
# File 'lib/hash_diff/comparison.rb', line 8 def right @right end |
Instance Method Details
#diff ⇒ Object
10 11 12 |
# File 'lib/hash_diff/comparison.rb', line 10 def diff @diff ||= find_differences { |l, r| [l, r] } end |
#left_diff ⇒ Object
14 15 16 |
# File 'lib/hash_diff/comparison.rb', line 14 def left_diff @left_diff ||= find_differences { |_, r| r } end |
#right_diff ⇒ Object
18 19 20 |
# File 'lib/hash_diff/comparison.rb', line 18 def right_diff @right_diff ||= find_differences { |l, _| l } end |