Class: HttpStub::Server::Stub::Match::HashWithStringValueMatchers
- Inherits:
-
Hash
- Object
- Hash
- HttpStub::Server::Stub::Match::HashWithStringValueMatchers
- Defined in:
- lib/http_stub/server/stub/match/hash_with_string_value_matchers.rb
Instance Method Summary collapse
-
#initialize(stub_hash) ⇒ HashWithStringValueMatchers
constructor
A new instance of HashWithStringValueMatchers.
- #matches?(actual_hash) ⇒ Boolean
Constructor Details
#initialize(stub_hash) ⇒ HashWithStringValueMatchers
Returns a new instance of HashWithStringValueMatchers.
8 9 10 11 12 |
# File 'lib/http_stub/server/stub/match/hash_with_string_value_matchers.rb', line 8 def initialize(stub_hash) stub_hash.each_pair do |key, value| self[key] = HttpStub::Server::Stub::Match::StringValueMatcher.new(value) end end |
Instance Method Details
#matches?(actual_hash) ⇒ Boolean
14 15 16 17 18 19 |
# File 'lib/http_stub/server/stub/match/hash_with_string_value_matchers.rb', line 14 def matches?(actual_hash) !(self.find do |key_and_value_matcher| key, value_matcher = key_and_value_matcher !value_matcher.matches?(actual_hash[key]) end) end |