Class: FlexMock::DuckMatcher
- Inherits:
-
Object
- Object
- FlexMock::DuckMatcher
- Defined in:
- lib/flexmock/argument_matchers.rb
Overview
Match only things where the block evaluates to true.
Instance Method Summary collapse
- #===(target) ⇒ Object
-
#initialize(methods) ⇒ DuckMatcher
constructor
A new instance of DuckMatcher.
- #inspect ⇒ Object
Constructor Details
#initialize(methods) ⇒ DuckMatcher
Returns a new instance of DuckMatcher.
73 74 75 |
# File 'lib/flexmock/argument_matchers.rb', line 73 def initialize(methods) @methods = methods end |
Instance Method Details
#===(target) ⇒ Object
76 77 78 |
# File 'lib/flexmock/argument_matchers.rb', line 76 def ===(target) @methods.all? { |m| target.respond_to?(m) } end |
#inspect ⇒ Object
79 80 81 |
# File 'lib/flexmock/argument_matchers.rb', line 79 def inspect "ducktype(#{@methods.map{|m| m.inspect}.join(',')})" end |