Class: Routing::ActorList

Inherits:
Object
  • Object
show all
Defined in:
lib/ara/routing.rb

Overview

:nodoc:

Instance Method Summary collapse

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(message)
   @actors.each do |actor|
      actor | message
   end
end

#get_actorObject



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