Class: FlexMock::HashMatcher
- Inherits:
-
Object
- Object
- FlexMock::HashMatcher
- Defined in:
- lib/flexmock/argument_matchers.rb
Overview
Match only things where the block evaluates to true.
Instance Method Summary collapse
- #===(target) ⇒ Object
-
#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 |
#inspect ⇒ Object
65 66 67 |
# File 'lib/flexmock/argument_matchers.rb', line 65 def inspect "hsh(#{@hash.inspect})" end |