Class: Delivered::RespondToType
- Inherits:
-
Object
- Object
- Delivered::RespondToType
- Defined in:
- lib/delivered/types.rb
Instance Method Summary collapse
- #===(value) ⇒ Object
-
#initialize(*methods) ⇒ RespondToType
constructor
A new instance of RespondToType.
- #inspect ⇒ Object
Constructor Details
#initialize(*methods) ⇒ RespondToType
Returns a new instance of RespondToType.
17 18 19 |
# File 'lib/delivered/types.rb', line 17 def initialize(*methods) @methods = methods end |
Instance Method Details
#===(value) ⇒ Object
23 24 25 |
# File 'lib/delivered/types.rb', line 23 def ===(value) @methods.all? { |m| value.respond_to?(m) } end |
#inspect ⇒ Object
21 |
# File 'lib/delivered/types.rb', line 21 def inspect = "RespondTo(#{@methods.map(&:inspect).join(', ')})" |