pluggaloid 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pluggaloid/collection.rb +4 -4
- data/lib/pluggaloid/error.rb +2 -0
- data/lib/pluggaloid/subscriber.rb +2 -1
- data/lib/pluggaloid/version.rb +1 -1
- data/test/reactive_test.rb +25 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 670ba6d6f6ed8b67776d57d76f9954d67e3b85a65b500220230f028568024c6e
|
4
|
+
data.tar.gz: 69f51e222382308669431a9bb7d60829b930f29ed5040b0c44ea230ba71fde67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 960b96120d905ae85cb11248607ca0e09442298641a23e37fcc6e9a8feea2295c9b9bf56e615f93a7a3005a1f7daabf07992026fa4f597f24b371615efb20815
|
7
|
+
data.tar.gz: c2966163091558506da0a11c82f30524a169ec554c23c0ed50d970bc6ae3d080af599be3764b27439b11dd3d933408ae7db935ee6f3fd5edf3267398a0bf6db7
|
@@ -13,15 +13,15 @@ module Pluggaloid
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def add(*v)
|
16
|
-
rewind do |
|
17
|
-
|
16
|
+
rewind do |primitive|
|
17
|
+
primitive + v
|
18
18
|
end
|
19
19
|
end
|
20
20
|
alias_method :<<, :add
|
21
21
|
|
22
22
|
def delete(*v)
|
23
|
-
rewind do |
|
24
|
-
|
23
|
+
rewind do |primitive|
|
24
|
+
primitive - v
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
data/lib/pluggaloid/error.rb
CHANGED
@@ -12,9 +12,10 @@ class Pluggaloid::Subscriber < Pluggaloid::Handler
|
|
12
12
|
# [tags:] Pluggaloid::HandlerTag|Array リスナのタグ
|
13
13
|
# [&callback] コールバック
|
14
14
|
def initialize(event, *specs, **kwrest, &callback)
|
15
|
+
raise Pluggaloid::UndefinedStreamIndexError, 'To call subscribe(), it must define prototype arguments include `Pluggaloid::STREAM\'.' unless event.stream_index
|
15
16
|
super(event, **kwrest)
|
16
17
|
@callback = callback
|
17
|
-
@accepted_hash = @event.argument_hash(specs,
|
18
|
+
@accepted_hash = @event.argument_hash(specs, nil)
|
18
19
|
event.add_listener(self)
|
19
20
|
end
|
20
21
|
|
data/lib/pluggaloid/version.rb
CHANGED
data/test/reactive_test.rb
CHANGED
@@ -32,9 +32,33 @@ describe(Pluggaloid::Plugin) do
|
|
32
32
|
assert_equal(%i[one], sum)
|
33
33
|
end
|
34
34
|
|
35
|
-
it "subscribe
|
35
|
+
it "subscribe 2" do
|
36
36
|
sum = []
|
37
37
|
|
38
|
+
Pluggaloid::Plugin.create(:event) do
|
39
|
+
defevent :increase, prototype: [Pluggaloid::STREAM, Integer]
|
40
|
+
subscribe(:increase, 1) do |v|
|
41
|
+
sum = v
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
eval_all_events do
|
46
|
+
Pluggaloid::Event[:increase].call([:one], 1)
|
47
|
+
Pluggaloid::Event[:increase].call([:two], 2)
|
48
|
+
end
|
49
|
+
|
50
|
+
assert_equal(%i[one], sum)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "raises subscribe without definition" do
|
54
|
+
assert_raises Pluggaloid::UndefinedStreamIndexError do
|
55
|
+
Pluggaloid::Plugin.create(:event) do
|
56
|
+
subscribe(:increase, 1) { ; }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
it "subscribe?" do
|
38
62
|
Pluggaloid::Plugin.create(:event) do
|
39
63
|
defevent :increase, prototype: [Integer, Pluggaloid::STREAM]
|
40
64
|
subscribe(:increase, 1) do |v|
|
@@ -46,8 +70,6 @@ describe(Pluggaloid::Plugin) do
|
|
46
70
|
end
|
47
71
|
|
48
72
|
it "subscribe? returns always true if plugin listener exist" do
|
49
|
-
sum = []
|
50
|
-
|
51
73
|
Pluggaloid::Plugin.create(:event) do
|
52
74
|
defevent :increase, prototype: [Integer, Pluggaloid::STREAM]
|
53
75
|
on_increase do |i, y|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pluggaloid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toshiaki Asai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: delayer
|