Class: Lookout::Expected::Hash

Inherits:
Object show all
Defined in:
lib/lookout-3.0/expected/hash.rb

Overview

Represents expected Hashes.

Instance Method Summary collapse

Methods inherited from Object

#expect

Instance Method Details

#difference(actual) ⇒ Difference::Hash?

Returns A difference report between ACTUAL and #expected unless their content exhibit no differences.

Parameters:

Returns:



8
9
10
11
12
13
# File 'lib/lookout-3.0/expected/hash.rb', line 8

def difference(actual)
  Lookout::Difference::Hash.new(actual, expected) unless
    Hash === actual and
    expected.size == actual.size and
    expected.none?{ |k, v| v.to_lookout_expected.difference(actual[k]) }
end