Class: Delivered::RespondToType

Inherits:
Object
  • Object
show all
Defined in:
lib/delivered/types.rb

Instance Method Summary collapse

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

#inspectObject



21
# File 'lib/delivered/types.rb', line 21

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