Class RR::WildcardMatchers::HashIncluding
In: lib/rr/wildcard_matchers/hash_including.rb
Parent: Object

Methods

==   eql?   inspect   new   wildcard_match?  

Attributes

expected_hash  [R] 

Public Class methods

[Source]

   # File lib/rr/wildcard_matchers/hash_including.rb, line 6
6:       def initialize(expected_hash)
7:         @expected_hash = expected_hash.clone
8:       end

Public Instance methods

[Source]

    # File lib/rr/wildcard_matchers/hash_including.rb, line 22
22:       def ==(other)
23:         return false unless other.is_a?(self.class)
24:         self.expected_hash == other.expected_hash
25:       end
eql?(other)

Alias for #==

[Source]

    # File lib/rr/wildcard_matchers/hash_including.rb, line 18
18:       def inspect
19:         "hash_including(#{expected_hash.inspect})"
20:       end

[Source]

    # File lib/rr/wildcard_matchers/hash_including.rb, line 10
10:       def wildcard_match?(other)
11:         return true if self == other
12:         expected_hash.each_pair do |key, value|
13:           return false unless other.has_key?(key) && other[key] == expected_hash[key]
14:         end
15:         return true
16:       end

[Validate]