Class: Crspec::Mock::ArgumentMatchers::Duck

Inherits:
Object
  • Object
show all
Defined in:
lib/crspec/mock/argument_matchers.rb

Instance Method Summary collapse

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) }

#inspectObject



89
# File 'lib/crspec/mock/argument_matchers.rb', line 89

def inspect = "duck_type(#{@methods.map(&:inspect).join(", ")})"