Class: HashDeepDiff::Reports::Base
- Inherits:
-
Object
- Object
- HashDeepDiff::Reports::Base
- Defined in:
- lib/hash_deep_diff/reports/base.rb
Overview
Abstract Class
Direct Known Subclasses
Instance Attribute Summary collapse
-
#change_key ⇒ Object
readonly
private
Returns the value of attribute change_key.
-
#new_val ⇒ Object
readonly
private
Returns the value of attribute new_val.
-
#old_val ⇒ Object
readonly
private
Returns the value of attribute old_val.
Instance Method Summary collapse
-
#initialize(delta:) ⇒ Base
constructor
private
A new instance of Base.
-
#original ⇒ Object
private
old value.
-
#replacement ⇒ Object
private
new value.
-
#to_s ⇒ String
see #to_str.
-
#to_str ⇒ String
A report on additions and deletions.
Constructor Details
#initialize(delta:) ⇒ Base (private)
Returns a new instance of Base.
25 26 27 28 29 |
# File 'lib/hash_deep_diff/reports/base.rb', line 25 def initialize(delta:) @change_key = delta.change_key.to_ary @old_val = delta.left @new_val = delta.right end |
Instance Attribute Details
#change_key ⇒ Object (readonly, private)
Returns the value of attribute change_key.
22 23 24 |
# File 'lib/hash_deep_diff/reports/base.rb', line 22 def change_key @change_key end |
#new_val ⇒ Object (readonly, private)
Returns the value of attribute new_val.
22 23 24 |
# File 'lib/hash_deep_diff/reports/base.rb', line 22 def new_val @new_val end |
#old_val ⇒ Object (readonly, private)
Returns the value of attribute old_val.
22 23 24 |
# File 'lib/hash_deep_diff/reports/base.rb', line 22 def old_val @old_val end |
Instance Method Details
#original ⇒ Object (private)
old value
32 33 34 |
# File 'lib/hash_deep_diff/reports/base.rb', line 32 def original raise AbstractMethodError end |
#replacement ⇒ Object (private)
new value
37 38 39 |
# File 'lib/hash_deep_diff/reports/base.rb', line 37 def replacement raise AbstractMethodError end |
#to_s ⇒ String
see #to_str
10 11 12 |
# File 'lib/hash_deep_diff/reports/base.rb', line 10 def to_s to_str end |
#to_str ⇒ String
A report on additions and deletions
16 17 18 |
# File 'lib/hash_deep_diff/reports/base.rb', line 16 def to_str original + replacement end |