Class: JsonDiff::HashDiff
- Inherits:
-
Object
- Object
- JsonDiff::HashDiff
- Includes:
- Helpers
- Defined in:
- lib/jsondiff/hash_diff.rb
Class Method Summary collapse
Methods included from Helpers
Class Method Details
.generate(result, prefix, hash1, hash2) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/jsondiff/hash_diff.rb', line 5 def self.generate(result, prefix, hash1, hash2) hash2.each do |key, value| if !hash1.has_key? key result << add_op(prefix, key, value) else value2 = hash1[key] if value != value2 JsonDiff.generate(value2, value, result, "#{prefix}/#{key}") end end end hash1.each do |key, value| unless hash2.has_key? key result << remove_op(prefix, key) end end result end |