Class: HashDeepDiff::Reports::Diff
- Defined in:
- lib/hash_deep_diff/reports/diff.rb
Overview
Visual representation of the Delta as diff
Instance Attribute Summary
Attributes inherited from Base
#change_key, #new_val, #old_val
Instance Method Summary collapse
-
#addition ⇒ String
private
visual indication of addition.
-
#deletion ⇒ String
private
visual indication of deletion.
-
#original ⇒ String
private
old value.
-
#path ⇒ String
private
Visual representation of keys from compared objects needed to fetch the compared values.
-
#replacement ⇒ String
private
new value.
Methods inherited from Base
Constructor Details
This class inherits a constructor from HashDeepDiff::Reports::Base
Instance Method Details
#addition ⇒ String (private)
visual indication of addition
36 37 38 |
# File 'lib/hash_deep_diff/reports/diff.rb', line 36 def addition '+left' end |
#deletion ⇒ String (private)
visual indication of deletion
42 43 44 |
# File 'lib/hash_deep_diff/reports/diff.rb', line 42 def deletion '-left' end |
#original ⇒ String (private)
old value
14 15 16 17 18 |
# File 'lib/hash_deep_diff/reports/diff.rb', line 14 def original return '' if old_val == NO_VALUE return "#{deletion}#{path} = #{old_val}\n" end |
#path ⇒ String (private)
Visual representation of keys from compared objects needed to fetch the compared values
30 31 32 |
# File 'lib/hash_deep_diff/reports/diff.rb', line 30 def path change_key.map { |key| "[#{key}]" }.join end |
#replacement ⇒ String (private)
new value
22 23 24 25 26 |
# File 'lib/hash_deep_diff/reports/diff.rb', line 22 def replacement return '' if new_val == NO_VALUE return "#{addition}#{path} = #{new_val}\n" end |