class RR::WildcardMatchers::HashIncluding
Attributes
Public Class Methods
Source
# File lib/rr/wildcard_matchers/hash_including.rb, line 6 def initialize(expected_hash) @expected_hash = expected_hash.dup end
Public Instance Methods
Source
# File lib/rr/wildcard_matchers/hash_including.rb, line 19 def ==(other) other.is_a?(self.class) && other.expected_hash == self.expected_hash end
Also aliased as: eql?
Source
# File lib/rr/wildcard_matchers/hash_including.rb, line 25 def inspect "hash_including(#{expected_hash.inspect})" end
Source
# File lib/rr/wildcard_matchers/hash_including.rb, line 10 def wildcard_match?(other) self == other || ( other.is_a?(Hash) && expected_hash.all? { |k, v| other.key?(k) && other[k] == expected_hash[k] } ) end