Class: EventHandlerWrapper

Inherits:
Object
  • Object
show all
Includes:
EventHandler
Defined in:
lib/fxmlloader/elts.rb

Instance Method Summary collapse

Constructor Details

#initialize(ctrl, funcName) ⇒ EventHandlerWrapper

Returns a new instance of EventHandlerWrapper.



549
550
551
552
# File 'lib/fxmlloader/elts.rb', line 549

def initialize(ctrl, funcName)
  @ctrl = ctrl
  @funcName = funcName
end

Instance Method Details

#handle(eventArgs) ⇒ Object



553
554
555
556
557
558
559
560
561
562
563
# File 'lib/fxmlloader/elts.rb', line 553

def handle(eventArgs)
  if @ctrl.respond_to? @funcName
    if @ctrl.method(@funcName).arity == 0
      @ctrl.send(@funcName)
    else
      @ctrl.send(@funcName, eventArgs)
    end
  else
    dputs "Warning: method #{@funcName} was not found on controller #{@ctrl}"
  end
end