Class: FlexMock::HashMatcher
- Defined in:
- lib/flexmock/argument_matchers.rb
Overview
Match hashes that match all the fields of hash
.
Instance Method Summary collapse
- #===(target) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(hash) ⇒ HashMatcher
constructor
A new instance of HashMatcher.
- #inspect ⇒ Object
Constructor Details
#initialize(hash) ⇒ HashMatcher
Returns a new instance of HashMatcher.
59 60 61 |
# File 'lib/flexmock/argument_matchers.rb', line 59 def initialize(hash) @hash = hash end |
Instance Method Details
#===(target) ⇒ Object
62 63 64 |
# File 'lib/flexmock/argument_matchers.rb', line 62 def ===(target) @hash.all? { |k, v| target[k] == v } end |
#empty? ⇒ Boolean
65 66 67 |
# File 'lib/flexmock/argument_matchers.rb', line 65 def empty? @hash.empty? end |
#inspect ⇒ Object
68 69 70 |
# File 'lib/flexmock/argument_matchers.rb', line 68 def inspect "hsh(#{@hash.inspect})" end |