Class: Routing::ActorList
- Inherits:
-
Object
- Object
- Routing::ActorList
- Defined in:
- lib/ara/routing.rb
Overview
:nodoc:
Instance Method Summary collapse
- #broadcast(message) ⇒ Object
- #get_actor ⇒ Object
-
#initialize(actors) ⇒ ActorList
constructor
A new instance of ActorList.
- #release_actor(actor) ⇒ Object
Constructor Details
#initialize(actors) ⇒ ActorList
Returns a new instance of ActorList.
23 24 25 26 27 |
# File 'lib/ara/routing.rb', line 23 def initialize(actors) @actors = actors @free_actors = Queue.new @actors.each { |actor| @free_actors << actor } end |
Instance Method Details
#broadcast(message) ⇒ Object
29 30 31 32 33 |
# File 'lib/ara/routing.rb', line 29 def broadcast() @actors.each do |actor| actor | end end |
#get_actor ⇒ Object
35 36 37 |
# File 'lib/ara/routing.rb', line 35 def get_actor @free_actors.shift end |
#release_actor(actor) ⇒ Object
39 40 41 |
# File 'lib/ara/routing.rb', line 39 def release_actor(actor) @free_actors << actor end |