octiron 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +2 -0
- data/lib/octiron/events/bus.rb +15 -12
- data/lib/octiron/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 336926004fffc1105bb354c76c1e5435d95b27fc
|
4
|
+
data.tar.gz: 9d6efe5638f209dfabf38062969b72dc0ce71ec6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05c58fdb427c609711728fb4f965a7e5a86cebe5ccac9d8f87043e1921c690562f775c0a14fb3204b7dc9b4a6d33fc6c2ddbad2999352aa2b5966d353193089a
|
7
|
+
data.tar.gz: fbec63c5c3956741db10a49445503aa8892d77956e3139e9539749b06e6b524998dc91e30992ec26f9b272b35d923537753b34ebdfcd4bbaed8a7708e57b5ac7
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
octiron (0.1.
|
4
|
+
octiron (0.1.1)
|
5
5
|
collapsium (~> 0.8)
|
6
6
|
rgl (~> 0.5)
|
7
7
|
|
@@ -50,7 +50,7 @@ GEM
|
|
50
50
|
simplecov-html (~> 0.10.0)
|
51
51
|
simplecov-html (0.10.0)
|
52
52
|
stream (0.5)
|
53
|
-
unicode-display_width (1.1.
|
53
|
+
unicode-display_width (1.1.2)
|
54
54
|
yard (0.9.5)
|
55
55
|
|
56
56
|
PLATFORMS
|
data/README.md
CHANGED
data/lib/octiron/events/bus.rb
CHANGED
@@ -41,12 +41,9 @@ module Octiron::Events
|
|
41
41
|
# must be provided.
|
42
42
|
# @return The class represented by the event_id, as a String name.
|
43
43
|
def subscribe(event_id, handler_object = nil, &handler_proc)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
handlers_for(event_name, true) << handler
|
48
|
-
|
49
|
-
return event_name
|
44
|
+
return with_handlers(event_id, handler_object, handler_proc) do |hlist, h|
|
45
|
+
hlist << h
|
46
|
+
end
|
50
47
|
end
|
51
48
|
alias register subscribe
|
52
49
|
|
@@ -62,12 +59,9 @@ module Octiron::Events
|
|
62
59
|
# must be provided.
|
63
60
|
# @return The class represented by the event_id, as a String name.
|
64
61
|
def unsubscribe(event_id, handler_object = nil, &handler_proc)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
handlers_for(event_name, true).delete(handler)
|
69
|
-
|
70
|
-
return event_name
|
62
|
+
return with_handlers(event_id, handler_object, handler_proc) do |hlist, h|
|
63
|
+
hlist.delete(h)
|
64
|
+
end
|
71
65
|
end
|
72
66
|
|
73
67
|
##
|
@@ -148,6 +142,15 @@ module Octiron::Events
|
|
148
142
|
return @handlers[name] || []
|
149
143
|
end
|
150
144
|
|
145
|
+
def with_handlers(event_id, handler_object, handler_proc)
|
146
|
+
handler = resolve_handler(handler_object, &handler_proc)
|
147
|
+
event_name = identify(event_id)
|
148
|
+
|
149
|
+
yield handlers_for(event_name, true), handler
|
150
|
+
|
151
|
+
return event_name
|
152
|
+
end
|
153
|
+
|
151
154
|
def resolve_handler(handler_object = nil, &handler_proc)
|
152
155
|
handler = handler_proc || handler_object
|
153
156
|
if not handler
|
data/lib/octiron/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octiron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Finkhaeuser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|