ntl-actor 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/actor.rb +0 -1
- data/lib/actor/actor.rb +33 -2
- data/lib/actor/supervisor.rb +1 -2
- metadata +2 -3
- data/lib/actor/build.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e81baca90d8dfc0b1138c86c5d447e746ee42b64
|
4
|
+
data.tar.gz: 07da40ca6364e24f1c3007b044736ca9a86e3cf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e20176f4addb6bed555fadd4375104322866effb7425ad71e99db449048f620e7f87f3c6bb09dd893839bff1aa67ca73c27a69bd28c648db57d006f1041d3c3
|
7
|
+
data.tar.gz: 9f1b7a7008b80e475679154c840121a4dc212066422aca82f1d2907adaec6f2e841ad504139d06e3e436e36c5fc926e8d5f8b1e85943ed16d3733c135b58370f
|
data/lib/actor.rb
CHANGED
data/lib/actor/actor.rb
CHANGED
@@ -12,11 +12,12 @@ module Actor
|
|
12
12
|
module Module
|
13
13
|
def self.included cls
|
14
14
|
cls.class_exec do
|
15
|
-
extend Build
|
16
15
|
extend HandleMacro
|
17
16
|
extend Start
|
18
17
|
|
19
18
|
include Observers
|
19
|
+
|
20
|
+
prepend Configure
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
@@ -94,11 +95,41 @@ module Actor
|
|
94
95
|
@writer ||= Messaging::Write::Substitute.new
|
95
96
|
end
|
96
97
|
|
98
|
+
module Configure
|
99
|
+
def configure
|
100
|
+
super
|
101
|
+
|
102
|
+
self.reader = Messaging::Read.build address
|
103
|
+
self.writer = Messaging::Write.new
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
97
107
|
module Start
|
98
108
|
def start *positional_arguments, address: nil, supervisor_address: nil, include: nil, **keyword_arguments, &block
|
99
109
|
address ||= Address.build
|
100
110
|
|
101
|
-
|
111
|
+
if respond_to? :build
|
112
|
+
constructor = method :build
|
113
|
+
else
|
114
|
+
constructor = method :new
|
115
|
+
end
|
116
|
+
|
117
|
+
if keyword_arguments.empty?
|
118
|
+
instance = constructor.(
|
119
|
+
*positional_arguments,
|
120
|
+
&block
|
121
|
+
)
|
122
|
+
else
|
123
|
+
instance = constructor.(
|
124
|
+
*positional_arguments,
|
125
|
+
**keyword_arguments,
|
126
|
+
&block
|
127
|
+
)
|
128
|
+
end
|
129
|
+
|
130
|
+
instance.address = address
|
131
|
+
|
132
|
+
instance.configure
|
102
133
|
|
103
134
|
thread = Actor::Start.(
|
104
135
|
instance,
|
data/lib/actor/supervisor.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ntl-actor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Ladd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Implementation of actor pattern for ruby designed for simplicity and
|
14
14
|
frugality
|
@@ -20,7 +20,6 @@ files:
|
|
20
20
|
- lib/actor.rb
|
21
21
|
- lib/actor/actor.rb
|
22
22
|
- lib/actor/address.rb
|
23
|
-
- lib/actor/build.rb
|
24
23
|
- lib/actor/controls.rb
|
25
24
|
- lib/actor/controls/actor.rb
|
26
25
|
- lib/actor/controls/address.rb
|
data/lib/actor/build.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
module Actor
|
2
|
-
module Build
|
3
|
-
def build address, *positional_arguments, **keyword_arguments, &block
|
4
|
-
if keyword_arguments.empty?
|
5
|
-
instance = new *positional_arguments, &block
|
6
|
-
else
|
7
|
-
instance = new *positional_arguments, **keyword_arguments, &block
|
8
|
-
end
|
9
|
-
|
10
|
-
instance.address = address
|
11
|
-
instance.reader = Messaging::Read.build address
|
12
|
-
instance.writer = Messaging::Write.new
|
13
|
-
|
14
|
-
instance.configure
|
15
|
-
|
16
|
-
instance
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|