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.



574
575
576
577
# File 'lib/hookr.rb', line 574

def initialize(handle, method, index)
  @method = method
  super(handle, index)
end

Instance Attribute Details

#methodObject (readonly)

Returns the value of attribute method.



572
573
574
# File 'lib/hookr.rb', line 572

def method
  @method
end

Instance Method Details

#call(event) ⇒ Object



579
580
581
# File 'lib/hookr.rb', line 579

def call(event)
  method.bind(event.source).call(*event.to_args(method.arity))
end