Class: Zyps::DestroyAction
- Inherits:
-
Action
- Object
- Action
- Zyps::DestroyAction
- Defined in:
- lib/zyps/actions.rb
Overview
Destroy the targets.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#environment ⇒ Object
The environment to remove objects from.
Instance Method Summary collapse
-
#do(actor, targets) ⇒ Object
Remove the target from the environment.
-
#initialize(environment) ⇒ DestroyAction
constructor
A new instance of DestroyAction.
Constructor Details
#initialize(environment) ⇒ DestroyAction
Returns a new instance of DestroyAction.
136 137 138 |
# File 'lib/zyps/actions.rb', line 136 def initialize(environment) self.environment = environment end |
Instance Attribute Details
#environment ⇒ Object
The environment to remove objects from.
135 136 137 |
# File 'lib/zyps/actions.rb', line 135 def environment @environment end |
Instance Method Details
#do(actor, targets) ⇒ Object
Remove the target from the environment.
140 141 142 143 144 |
# File 'lib/zyps/actions.rb', line 140 def do(actor, targets) targets.each do |target| @environment.objects.delete(target) end end |