Module: Bparity::Verification::Differ

Defined in:
lib/bparity/verification.rb

Constant Summary collapse

MISSING =
Object.new.freeze

Class Method Summary collapse

Class Method Details

.call(expected, actual, path = "$") ⇒ Object



18
19
20
21
22
23
24
# File 'lib/bparity/verification.rb', line 18

def call(expected, actual, path = "$")
  return [] if expected == actual
  return hash_diff(expected, actual, path) if expected.is_a?(Hash) && actual.is_a?(Hash)
  return array_diff(expected, actual, path) if expected.is_a?(Array) && actual.is_a?(Array)

  [{ "path" => path, "expected" => expected, "actual" => actual }]
end