Class: ArcadiaActionDispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/a-core.rb

Instance Method Summary collapse

Constructor Details

#initialize(_arcadia) ⇒ ArcadiaActionDispatcher

Returns a new instance of ArcadiaActionDispatcher.



2672
2673
2674
2675
# File 'lib/a-core.rb', line 2672

def initialize(_arcadia)
  @arcadia = _arcadia
  Arcadia.attach_listener(self, ActionEvent)
end

Instance Method Details

#on_action(_event) ⇒ Object



2677
2678
2679
2680
2681
2682
2683
2684
2685
# File 'lib/a-core.rb', line 2677

def on_action(_event)
  if _event.receiver != nil && _event.receiver.respond_to?(_event.action)
    if _event.action_args.nil?
      _event.receiver.send(_event.action)
    else
      _event.receiver.send(_event.action, _event.action_args)
    end
  end
end