Class: ZombieList
- Inherits:
-
Object
- Object
- ZombieList
- Defined in:
- lib/zombie-chaser/human.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #draw_zombies ⇒ Object
- #each_zombie ⇒ Object
-
#initialize(zombie_factory) ⇒ ZombieList
constructor
A new instance of ZombieList.
- #supply_next_zombie ⇒ Object
Constructor Details
#initialize(zombie_factory) ⇒ ZombieList
Returns a new instance of ZombieList.
208 209 210 211 |
# File 'lib/zombie-chaser/human.rb', line 208 def initialize(zombie_factory) @zombie_factory = zombie_factory @zombies = [] end |
Class Method Details
.new_using_test_unit_handler(test_pattern, world) ⇒ Object
203 204 205 206 |
# File 'lib/zombie-chaser/human.rb', line 203 def self.new_using_test_unit_handler(test_pattern, world) zombie_factory = ZombieFactory.new(test_pattern, world) new(zombie_factory) end |
Instance Method Details
#draw_zombies ⇒ Object
223 224 225 |
# File 'lib/zombie-chaser/human.rb', line 223 def draw_zombies each_zombie {|zombie| zombie.draw} end |
#each_zombie ⇒ Object
219 220 221 |
# File 'lib/zombie-chaser/human.rb', line 219 def each_zombie @zombies.each{|zombie| yield zombie} end |
#supply_next_zombie ⇒ Object
213 214 215 216 217 |
# File 'lib/zombie-chaser/human.rb', line 213 def supply_next_zombie zombie = @zombie_factory.create_zombie @zombies << zombie zombie end |