Class: HookR::MethodCallback
Overview
A callback which will call a method on the event source
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Attributes inherited from Callback
Instance Method Summary collapse
- #call(event) ⇒ Object
-
#initialize(handle, method, index) ⇒ MethodCallback
constructor
A new instance of MethodCallback.
Methods inherited from Callback
Constructor Details
#initialize(handle, method, index) ⇒ MethodCallback
Returns a new instance of MethodCallback.
589 590 591 592 |
# File 'lib/hookr.rb', line 589 def initialize(handle, method, index) @method = method super(handle, index) end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
587 588 589 |
# File 'lib/hookr.rb', line 587 def method @method end |
Instance Method Details
#call(event) ⇒ Object
594 595 596 |
# File 'lib/hookr.rb', line 594 def call(event) method.bind(event.source).call(*event.to_args(method.arity)) end |