Class: Actor::Supervisor
- Inherits:
-
Object
- Object
- Actor::Supervisor
- Includes:
- Actor
- Defined in:
- lib/actor/supervisor.rb
Defined Under Namespace
Classes: ActorCrashed
Class Attribute Summary collapse
-
.address ⇒ Object
Returns the value of attribute address.
Instance Attribute Summary collapse
-
#assembly ⇒ Object
readonly
Returns the value of attribute assembly.
- #broadcast_address ⇒ Object
-
#error ⇒ Object
Returns the value of attribute error.
- #router_address ⇒ Object
- #thread_group ⇒ Object
Class Method Summary collapse
Instance Method Summary collapse
- #actor_threads ⇒ Object
- #configure ⇒ Object
-
#initialize(&assembly) ⇒ Supervisor
constructor
A new instance of Supervisor.
Methods included from Actor
Constructor Details
#initialize(&assembly) ⇒ Supervisor
Returns a new instance of Supervisor.
11 12 13 |
# File 'lib/actor/supervisor.rb', line 11 def initialize &assembly @assembly = assembly end |
Class Attribute Details
.address ⇒ Object
Returns the value of attribute address.
16 17 18 |
# File 'lib/actor/supervisor.rb', line 16 def address @address end |
Instance Attribute Details
#assembly ⇒ Object (readonly)
Returns the value of attribute assembly.
5 6 7 |
# File 'lib/actor/supervisor.rb', line 5 def assembly @assembly end |
#broadcast_address ⇒ Object
81 82 83 |
# File 'lib/actor/supervisor.rb', line 81 def broadcast_address @broadcast_address ||= Address::None end |
#error ⇒ Object
Returns the value of attribute error.
7 8 9 |
# File 'lib/actor/supervisor.rb', line 7 def error @error end |
#router_address ⇒ Object
85 86 87 |
# File 'lib/actor/supervisor.rb', line 85 def router_address @router_address ||= Address::None end |
#thread_group ⇒ Object
89 90 91 |
# File 'lib/actor/supervisor.rb', line 89 def thread_group @thread_group ||= Substitutes::ThreadGroup.new end |
Class Method Details
.run(&assembly) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/actor/supervisor.rb', line 18 def run &assembly self.address = Address.build instance = build address, &assembly thread = Start.(instance, address) thread.join end |
Instance Method Details
#actor_threads ⇒ Object
69 70 71 72 73 |
# File 'lib/actor/supervisor.rb', line 69 def actor_threads list = thread_group.list list.delete Thread.current list end |
#configure ⇒ Object
75 76 77 78 79 |
# File 'lib/actor/supervisor.rb', line 75 def configure self.broadcast_address = Address.build self.router_address = Router.start self.thread_group = ThreadGroup.new end |