Class: HttpStub::Models::HashWithRegexpableValues
- Inherits:
-
Hash
- Object
- Hash
- HttpStub::Models::HashWithRegexpableValues
- Defined in:
- lib/http_stub/models/hash_with_regexpable_values.rb
Instance Method Summary collapse
-
#initialize(hash) ⇒ HashWithRegexpableValues
constructor
A new instance of HashWithRegexpableValues.
- #match?(other_hash) ⇒ Boolean
Constructor Details
#initialize(hash) ⇒ HashWithRegexpableValues
Returns a new instance of HashWithRegexpableValues.
6 7 8 |
# File 'lib/http_stub/models/hash_with_regexpable_values.rb', line 6 def initialize(hash) hash.each_pair { |key, value| self[key] = HttpStub::Models::RegexpableValue.new(value) } end |
Instance Method Details
#match?(other_hash) ⇒ Boolean
10 11 12 13 14 15 |
# File 'lib/http_stub/models/hash_with_regexpable_values.rb', line 10 def match?(other_hash) !(self.find do |key_and_regexpable_value| other_value = other_hash[key_and_regexpable_value[0]] !(other_value && key_and_regexpable_value[1].match?(other_value)) end) end |