pubsubhub 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pubsubhub.rb +11 -2
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12614d476540ab9a354cbe25146ca0b46071a767
|
4
|
+
data.tar.gz: e078352ae006b35f040fc28d8abbc03282b6e9f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 017ec4ea661a700776b3ec5cf8f7f55e31a91182f8049402c6db7bcb1aba9a62e073647c419117c187e337075366c78b9f0ba01edbf6adebe0a12397463505f7
|
7
|
+
data.tar.gz: 8e584681eaeb6bbefb1d59c1ca5feb98fd940d8aff44d48f1b86f321b87188679f9e18929f34cedd3c83330e7d8fd8fe860a3f2cea952fedfba7db58ee512ee1
|
data/lib/pubsubhub.rb
CHANGED
@@ -51,7 +51,7 @@ require 'singleton'
|
|
51
51
|
class PubSubHub
|
52
52
|
include Singleton
|
53
53
|
|
54
|
-
VERSION = '0.0.
|
54
|
+
VERSION = '0.0.4'
|
55
55
|
|
56
56
|
class << self
|
57
57
|
extend Forwardable
|
@@ -97,7 +97,7 @@ class PubSubHub
|
|
97
97
|
def trigger(event_name, *args)
|
98
98
|
@registry.fetch(event_name.to_sym, []).each do |registration|
|
99
99
|
begin
|
100
|
-
listener =
|
100
|
+
listener = constantize(registration[:listener])
|
101
101
|
async = registration[:async]
|
102
102
|
handler = :"handle_#{event_name}"
|
103
103
|
|
@@ -121,4 +121,13 @@ private
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
end
|
124
|
+
|
125
|
+
# Object.get_const can't handle namespaces and Rails' constantize introduces
|
126
|
+
# Rails dependencies
|
127
|
+
def constantize(camel_cased_word)
|
128
|
+
names = camel_cased_word.split('::')
|
129
|
+
names.reduce(Object) do |const, name|
|
130
|
+
const.const_get(name)
|
131
|
+
end
|
132
|
+
end
|
124
133
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pubsubhub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Causes Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: coveralls
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: PubSubHub allows you to loosen the coupling between components in a system
|
70
84
|
by providing a centralized registry of events and listeners that subscribe to them.
|
71
85
|
email:
|