Class: HttpStub::Server::Stub::HashWithStringValueMatchers
- Inherits:
-
Hash
- Object
- Hash
- HttpStub::Server::Stub::HashWithStringValueMatchers
- Defined in:
- lib/http_stub/server/stub/hash_with_string_value_matchers.rb
Instance Method Summary collapse
-
#initialize(stub_hash) ⇒ HashWithStringValueMatchers
constructor
A new instance of HashWithStringValueMatchers.
- #match?(actual_hash) ⇒ Boolean
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
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 |