Class: Kind::RespondTo

Inherits:
Object
  • Object
show all
Includes:
BasicObject
Defined in:
lib/kind/objects/respond_to.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BasicObject

#[], #or, #or_nil, #or_null, #or_undefined, #value, #value?

Constructor Details

#initialize(method_names) ⇒ RespondTo

Returns a new instance of RespondTo.



17
18
19
20
# File 'lib/kind/objects/respond_to.rb', line 17

def initialize(method_names)
  @method_names = method_names
  @inspect = "Kind::RespondTo#{@method_names}"
end

Instance Attribute Details

#inspectObject (readonly) Also known as: name

Returns the value of attribute inspect.



15
16
17
# File 'lib/kind/objects/respond_to.rb', line 15

def inspect
  @inspect
end

Class Method Details

.[](*args) ⇒ Object



7
8
9
10
11
# File 'lib/kind/objects/respond_to.rb', line 7

def self.[](*args)
  args.each { |arg| STRICT.kind_of(::Symbol, arg) }

  new(args)
end

Instance Method Details

#===(value) ⇒ Object Also known as: call



22
23
24
# File 'lib/kind/objects/respond_to.rb', line 22

def ===(value)
  KIND.interface?(@method_names, value)
end