Class: EventHandlerWrapper
- Inherits:
-
Object
- Object
- EventHandlerWrapper
- Includes:
- EventHandler
- Defined in:
- lib/fxmlloader/elts.rb
Instance Attribute Summary collapse
-
#funcName ⇒ Object
readonly
Returns the value of attribute funcName.
Instance Method Summary collapse
- #handle(eventArgs) ⇒ Object
-
#initialize(ctrl, funcName) ⇒ EventHandlerWrapper
constructor
A new instance of EventHandlerWrapper.
Constructor Details
#initialize(ctrl, funcName) ⇒ EventHandlerWrapper
Returns a new instance of EventHandlerWrapper.
514 515 516 517 |
# File 'lib/fxmlloader/elts.rb', line 514 def initialize(ctrl, funcName) @ctrl = ctrl @funcName = funcName end |
Instance Attribute Details
#funcName ⇒ Object (readonly)
Returns the value of attribute funcName.
513 514 515 |
# File 'lib/fxmlloader/elts.rb', line 513 def funcName @funcName end |
Instance Method Details
#handle(eventArgs) ⇒ Object
518 519 520 521 522 523 524 525 526 527 528 |
# File 'lib/fxmlloader/elts.rb', line 518 def handle(eventArgs) if @ctrl.respond_to? @funcName if @ctrl.method(@funcName).arity == 0 @ctrl.send(@funcName) else @ctrl.send(@funcName, eventArgs) end else puts "Warning: method #{@funcName} was not found on controller #{@ctrl}" end end |