Class: HttpStub::Models::HashWithStringValueMatchers
- Inherits:
-
Hash
- Object
- Hash
- HttpStub::Models::HashWithStringValueMatchers
- Defined in:
- lib/http_stub/models/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.
6 7 8 |
# File 'lib/http_stub/models/hash_with_string_value_matchers.rb', line 6 def initialize(stub_hash) stub_hash.each_pair { |key, value| self[key] = HttpStub::Models::StringValueMatcher.new(value) } end |
Instance Method Details
#match?(actual_hash) ⇒ Boolean
10 11 12 13 14 15 |
# File 'lib/http_stub/models/hash_with_string_value_matchers.rb', line 10 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 |