Class: Contracts::Constraints::RespondTo
Direct Known Subclasses
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(*methods) ⇒ RespondTo
constructor
A new instance of RespondTo.
- #matches?(value) ⇒ Boolean
Methods inherited from Base
Constructor Details
#initialize(*methods) ⇒ RespondTo
Returns a new instance of RespondTo.
268 |
# File 'lib/contracts.rb', line 268 def initialize(*methods) = @methods = methods |
Instance Method Details
#description ⇒ Object
270 |
# File 'lib/contracts.rb', line 270 def description = "responding to #{@methods.join(', ')}" |
#matches?(value) ⇒ Boolean
269 |
# File 'lib/contracts.rb', line 269 def matches?(value) = @methods.all? { |method| value.respond_to?(method) } |