Class: Callback

Inherits:
Struct
  • Object
show all
Defined in:
lib/project/callback.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



2
3
4
# File 'lib/project/callback.rb', line 2

def method_missing(name, *)
  name == :"#{called}?" || (name == called && block_given? && yield(*args))
end

Instance Attribute Details

#argsObject

Returns the value of attribute args



1
2
3
# File 'lib/project/callback.rb', line 1

def args
  @args
end

#calledObject

Returns the value of attribute called



1
2
3
# File 'lib/project/callback.rb', line 1

def called
  @called
end