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.
611 612 613 614 |
# File 'lib/hookr.rb', line 611 def initialize(handle, method, index) @method = method super(handle, index) end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
609 610 611 |
# File 'lib/hookr.rb', line 609 def method @method end |
Instance Method Details
#call(event) ⇒ Object
616 617 618 |
# File 'lib/hookr.rb', line 616 def call(event) method.bind(event.source).call(*event.to_args(method.arity)) end |