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.



1679
1680
1681
1682
# File 'lib/a-core.rb', line 1679

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

Instance Method Details

#on_action(_event) ⇒ Object



1684
1685
1686
1687
1688
1689
1690
1691
1692
# File 'lib/a-core.rb', line 1684

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