Class: HookR::MethodCallback

Inherits:
Callback
  • Object
show all
Defined in:
lib/hookr.rb

Overview

A callback which will call a method on the event source

Instance Attribute Summary collapse

Attributes inherited from Callback

#handle, #index

Instance Method Summary collapse

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

#methodObject (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