Class: Philiprehberger::Differ::Comparator
- Inherits:
-
Object
- Object
- Philiprehberger::Differ::Comparator
- Defined in:
- lib/philiprehberger/differ/comparator.rb
Class Method Summary collapse
Class Method Details
.call(old_val, new_val, path: '', ignore: [], array_key: nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/philiprehberger/differ/comparator.rb', line 6 def self.call(old_val, new_val, path: '', ignore: [], array_key: nil) return [] if ignored?(path, ignore) opts = { ignore: ignore, array_key: array_key } case [old_val, new_val] in [Hash, Hash] then compare_hashes(old_val, new_val, path, opts) in [Array, Array] then compare_arrays(old_val, new_val, path, opts) else compare_scalars(old_val, new_val, path) end end |