resugan 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/lib/resugan/context.rb +2 -4
- data/lib/resugan/engine/inline_dispatcher.rb +11 -0
- data/lib/resugan/kernel.rb +10 -1
- data/lib/resugan/version.rb +1 -1
- data/lib/resugan.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06266abd04e9aecee4b5a28654d177b0e2780dfd
|
4
|
+
data.tar.gz: ff5a9e7c6a3bd73fe07c6572796aca4006812b11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0465ac0358fb465cf1ccf2388d466c48a080eb0586362a313a3d9b4c701992fda770da3e3d835e74231ed9fb5c83b5914e7669c7b44c614444e5274e1aa2853
|
7
|
+
data.tar.gz: 50d00661a3f35779bbda13d26fc86483fce997764fe987f0f0a2ea7ea72c3c8baf6e26815a182e8fd0bfdceb5196fcaf739bf47267d403bc298bfef86841277a
|
data/lib/resugan/context.rb
CHANGED
@@ -16,10 +16,8 @@ module Resugan
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def invoke
|
19
|
-
|
20
|
-
|
21
|
-
Resugan::Kernel.invoke(@namespace, k, v)
|
22
|
-
end
|
19
|
+
dispatcher = Resugan::Kernel.dispatcher_for(@namespace)
|
20
|
+
dispatcher.dispatch(@namespace, @events)
|
23
21
|
end
|
24
22
|
end
|
25
23
|
end
|
data/lib/resugan/kernel.rb
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
module Resugan
|
2
2
|
class Kernel
|
3
|
+
def self.dispatcher_for(namespace = '')
|
4
|
+
@dispatchers = {} unless @dispatchers
|
5
|
+
@dispatchers[namespace] || Resugan::Engine::InlineDispatcher.new
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.register_dispatcher(dispatcher, namespace = '')
|
9
|
+
@dispatchers = {} unless @dispatchers
|
10
|
+
@dispatchers[namespace] = dispatcher
|
11
|
+
end
|
12
|
+
|
3
13
|
def self.register(event, block)
|
4
14
|
register_with_namespace("", event, block)
|
5
15
|
end
|
@@ -20,7 +30,6 @@ module Resugan
|
|
20
30
|
|
21
31
|
def self.invoke(namespace, event, payload = [])
|
22
32
|
event = "#{namespace}_#{event}".to_sym
|
23
|
-
p payload
|
24
33
|
if @listener[event]
|
25
34
|
@listener[event].each do |listener|
|
26
35
|
listener.call(payload.map { |p| p[:params] })
|
data/lib/resugan/version.rb
CHANGED
data/lib/resugan.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resugan
|
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
|
- Joseph Emmanuel Dayo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- bin/setup
|
86
86
|
- lib/resugan.rb
|
87
87
|
- lib/resugan/context.rb
|
88
|
+
- lib/resugan/engine/inline_dispatcher.rb
|
88
89
|
- lib/resugan/kernel.rb
|
89
90
|
- lib/resugan/object.rb
|
90
91
|
- lib/resugan/object_helpers.rb
|