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.



611
612
613
614
# File 'lib/hookr.rb', line 611

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

Instance Attribute Details

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