Class: Rubygame::EventActions::MultiAction
- Inherits:
-
Object
- Object
- Rubygame::EventActions::MultiAction
- Defined in:
- lib/rubygame/event_actions.rb
Overview
MultiAction is an event action used with EventHook. It takes zero or more actions (e.g. BlockAction or MethodAction instances) at initialization.
When MultiAction is performed, it performs all the given actions, in the order they were given, passing in the owner and event.
As the name suggests, you can use MultiAction to cause multiple actions to occur when an EventHook is triggered.
Instance Method Summary collapse
-
#initialize(*actions) ⇒ MultiAction
constructor
Create a new MultiAction instance with the given sub-actions.
-
#perform(owner, event) ⇒ Object
Performs all the sub-actions, in the order they were given, passing in the owner and event to each one.
Constructor Details
#initialize(*actions) ⇒ MultiAction
Create a new MultiAction instance with the given sub-actions.
- *actions
-
the actions to perform. (Action instances)
191 192 193 |
# File 'lib/rubygame/event_actions.rb', line 191 def initialize( *actions ) @actions = actions end |
Instance Method Details
#perform(owner, event) ⇒ Object
Performs all the sub-actions, in the order they were given, passing in the owner and event to each one.
198 199 200 |
# File 'lib/rubygame/event_actions.rb', line 198 def perform( owner, event ) @actions.each { |action| action.perform( owner, event ) } end |