Module: RPV::Swing::BaseHandler

Defined in:
lib/rpv/swing/events.rb

Overview

This module is used internally by the various XYZHandler classes as the recipent of events. It dispatches the event handling to the controller’s handle_event method.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/rpv/swing/events.rb', line 13

def method_missing(method, *args, &block)
  if @event_names.keys.member?(method.underscore)
    event_alias = @event_names[method.underscore]
    unless @callback.nil?
      @callback.handle_event(@component_name, event_alias, args[0])
    else
      @block.call @component_name, event_alias, args[0]
    end
  end
end