class RR::WildcardMatchers::HashIncluding
Attributes
expected_hash[R]
Public Class Methods
new(expected_hash)
click to toggle source
# File lib/rr/wildcard_matchers/hash_including.rb, line 6 def initialize(expected_hash) @expected_hash = expected_hash.clone end
Public Instance Methods
==(other)
click to toggle source
# File lib/rr/wildcard_matchers/hash_including.rb, line 22 def ==(other) return false unless other.is_a?(self.class) self.expected_hash == other.expected_hash end
Also aliased as: eql?
inspect()
click to toggle source
# File lib/rr/wildcard_matchers/hash_including.rb, line 18 def inspect "hash_including(#{expected_hash.inspect})" end
wildcard_match?(other)
click to toggle source
# File lib/rr/wildcard_matchers/hash_including.rb, line 10 def wildcard_match?(other) return true if self == other expected_hash.each_pair do |key, value| return false unless other.has_key?(key) && other[key] == expected_hash[key] end return true end