ntl-actor 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/actor/actor.rb +2 -9
- data/lib/actor/supervisor.rb +25 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 067110e074ae7bb81a31423f2a096e4c17ee9009
|
4
|
+
data.tar.gz: 6b0e35af11830125b4ba65ef6f34e52f0289e8cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 092fd9158294ef024fd0332730b5c6ad20ee602e301c436436a4c70c72068ad01d451fcb1d68c070a3c01a87a59a365b13d1df8bbbe3e3959f934bd9f070d1fd
|
7
|
+
data.tar.gz: 3a58c4dfab83e50ff8d7ef5704a20b8093dca2abb88f092cc1139a91a260dad80ab8da1a28d6e2743b466de2ef787ea2628ab25396e7c75b8e3d53bc007752a4
|
data/lib/actor/actor.rb
CHANGED
@@ -115,16 +115,9 @@ module Actor
|
|
115
115
|
end
|
116
116
|
|
117
117
|
if keyword_arguments.empty?
|
118
|
-
instance = constructor.(
|
119
|
-
*positional_arguments,
|
120
|
-
&block
|
121
|
-
)
|
118
|
+
instance = constructor.(*positional_arguments, &block)
|
122
119
|
else
|
123
|
-
instance = constructor.(
|
124
|
-
*positional_arguments,
|
125
|
-
**keyword_arguments,
|
126
|
-
&block
|
127
|
-
)
|
120
|
+
instance = constructor.(*positional_arguments, **keyword_arguments, &block)
|
128
121
|
end
|
129
122
|
|
130
123
|
instance.address = address
|
data/lib/actor/supervisor.rb
CHANGED
@@ -18,10 +18,31 @@ module Actor
|
|
18
18
|
def run &assembly
|
19
19
|
self.address = Address.build
|
20
20
|
|
21
|
-
_, thread = start
|
21
|
+
_, thread = start include: %i(thread), &assembly
|
22
22
|
|
23
23
|
thread.join
|
24
24
|
end
|
25
|
+
|
26
|
+
def build &assembly
|
27
|
+
instance = new &assembly
|
28
|
+
instance.configure
|
29
|
+
instance
|
30
|
+
end
|
31
|
+
|
32
|
+
def start include: nil, &assembly
|
33
|
+
instance = build &assembly
|
34
|
+
|
35
|
+
start = Messages::Start.new
|
36
|
+
instance.writer.(start, address)
|
37
|
+
|
38
|
+
thread = Thread.new do
|
39
|
+
instance.start
|
40
|
+
end
|
41
|
+
|
42
|
+
thread.name = "Supervisor"
|
43
|
+
|
44
|
+
Destructure.(address, include, { :thread => thread, :actor => instance })
|
45
|
+
end
|
25
46
|
end
|
26
47
|
|
27
48
|
handle :start do
|
@@ -35,6 +56,8 @@ module Actor
|
|
35
56
|
|
36
57
|
handle :continue do
|
37
58
|
if actor_threads.empty?
|
59
|
+
raise error if error
|
60
|
+
|
38
61
|
:stop
|
39
62
|
else
|
40
63
|
:continue
|
@@ -75,6 +98,7 @@ module Actor
|
|
75
98
|
self.broadcast_address = Address.build
|
76
99
|
self.router_address = Router.start
|
77
100
|
self.thread_group = ThreadGroup.new
|
101
|
+
self.address = self.class.address
|
78
102
|
end
|
79
103
|
|
80
104
|
def broadcast_address
|