Class: Zyps::DestroyAction

Inherits:
Action
  • Object
show all
Defined in:
lib/zyps/actions.rb

Overview

Destroy the targets.

Direct Known Subclasses

EatAction

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#environmentObject

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