Class: HttpStub::Server::Stub::HashWithStringValueMatchers

Inherits:
Hash
  • Object
show all
Defined in:
lib/http_stub/server/stub/hash_with_string_value_matchers.rb

Instance Method Summary collapse

Constructor Details

#initialize(stub_hash) ⇒ HashWithStringValueMatchers

Returns a new instance of HashWithStringValueMatchers.



7
8
9
# File 'lib/http_stub/server/stub/hash_with_string_value_matchers.rb', line 7

def initialize(stub_hash)
  stub_hash.each_pair { |key, value| self[key] = HttpStub::Server::Stub::StringValueMatcher.new(value) }
end

Instance Method Details

#match?(actual_hash) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
# File 'lib/http_stub/server/stub/hash_with_string_value_matchers.rb', line 11

def match?(actual_hash)
  !(self.find do |key_and_value_matcher|
    key, value_matcher = key_and_value_matcher
    !value_matcher.match?(actual_hash[key])
  end)
end