Class: Crspec::Mock::ArgumentMatchers::Duck
- Inherits:
-
Object
- Object
- Crspec::Mock::ArgumentMatchers::Duck
- Defined in:
- lib/crspec/mock/argument_matchers.rb
Instance Method Summary collapse
- #===(actual) ⇒ Object (also: #==)
-
#initialize(*methods) ⇒ Duck
constructor
A new instance of Duck.
- #inspect ⇒ Object
Constructor Details
#initialize(*methods) ⇒ Duck
Returns a new instance of Duck.
82 83 84 |
# File 'lib/crspec/mock/argument_matchers.rb', line 82 def initialize(*methods) @methods = methods end |
Instance Method Details
#===(actual) ⇒ Object Also known as: ==
86 |
# File 'lib/crspec/mock/argument_matchers.rb', line 86 def ===(actual) = @methods.all? { |m| actual.respond_to?(m) } |
#inspect ⇒ Object
89 |
# File 'lib/crspec/mock/argument_matchers.rb', line 89 def inspect = "duck_type(#{@methods.map(&:inspect).join(", ")})" |