Class: World
Instance Method Summary collapse
- #[](agent) ⇒ Object
- #dump ⇒ Object
- #each ⇒ Object
-
#initialize(names) ⇒ World
constructor
A new instance of World.
Constructor Details
#initialize(names) ⇒ World
Returns a new instance of World.
6 7 8 |
# File 'lib/agens/world.rb', line 6 def initialize(names) @names = names end |
Instance Method Details
#[](agent) ⇒ Object
10 11 12 |
# File 'lib/agens/world.rb', line 10 def [](agent) Celluloid::Actor[agent] end |
#dump ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/agens/world.rb', line 20 def dump puts 'World contains:' self.each do |agent| puts agent.to_s end end |
#each ⇒ Object
14 15 16 17 18 |
# File 'lib/agens/world.rb', line 14 def each @names.each do |agent| yield self[agent] end end |