Class: World

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/agens/world.rb

Instance Method Summary collapse

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

#dumpObject



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

#eachObject



14
15
16
17
18
# File 'lib/agens/world.rb', line 14

def each
	@names.each do |agent|
		yield self[agent]
	end
end