promiscuous 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/promiscuous/observer.rb +4 -0
- data/lib/promiscuous/subscriber/observer.rb +28 -0
- data/lib/promiscuous/subscriber.rb +1 -0
- data/lib/promiscuous/version.rb +1 -1
- data/lib/promiscuous.rb +1 -0
- metadata +21 -3
@@ -0,0 +1,28 @@
|
|
1
|
+
class Promiscuous::Subscriber::Observer < Promiscuous::Subscriber::Base
|
2
|
+
include Promiscuous::Subscriber::Class
|
3
|
+
include Promiscuous::Subscriber::Attributes
|
4
|
+
include Promiscuous::Subscriber::AMQP
|
5
|
+
include Promiscuous::Subscriber::Envelope
|
6
|
+
|
7
|
+
def fetch
|
8
|
+
klass.new.tap { |o| o.id = id if o.respond_to?(:id=) }
|
9
|
+
end
|
10
|
+
|
11
|
+
def process
|
12
|
+
super
|
13
|
+
instance.run_callbacks operation
|
14
|
+
end
|
15
|
+
|
16
|
+
# XXX destroy callbacks will not set attributes (they are not sent)
|
17
|
+
def process_attributes?
|
18
|
+
operation != :destroy
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.subscribe(options)
|
22
|
+
super
|
23
|
+
raise "#{klass} must inherit from Promiscuous::Observer" unless klass < Promiscuous::Observer
|
24
|
+
|
25
|
+
use_payload_attribute :id
|
26
|
+
use_payload_attribute :operation, :symbolize => true
|
27
|
+
end
|
28
|
+
end
|
@@ -11,6 +11,7 @@ module Promiscuous::Subscriber
|
|
11
11
|
autoload :Mongoid, 'promiscuous/subscriber/mongoid'
|
12
12
|
autoload :Polymorphic, 'promiscuous/subscriber/polymorphic'
|
13
13
|
autoload :Upsert, 'promiscuous/subscriber/upsert'
|
14
|
+
autoload :Observer, 'promiscuous/subscriber/observer'
|
14
15
|
|
15
16
|
def self.lint(*args)
|
16
17
|
Lint.lint(*args)
|
data/lib/promiscuous/version.rb
CHANGED
data/lib/promiscuous.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: promiscuous
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-10-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -28,6 +28,22 @@ dependencies:
|
|
28
28
|
- - ! '>='
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '0'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: activemodel
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
type: :runtime
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
31
47
|
- !ruby/object:Gem::Dependency
|
32
48
|
name: bunny
|
33
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,6 +139,7 @@ files:
|
|
123
139
|
- lib/promiscuous/subscriber/class.rb
|
124
140
|
- lib/promiscuous/subscriber/polymorphic.rb
|
125
141
|
- lib/promiscuous/subscriber/attributes.rb
|
142
|
+
- lib/promiscuous/subscriber/observer.rb
|
126
143
|
- lib/promiscuous/config.rb
|
127
144
|
- lib/promiscuous/amqp.rb
|
128
145
|
- lib/promiscuous/common/lint.rb
|
@@ -132,9 +149,10 @@ files:
|
|
132
149
|
- lib/promiscuous/loader.rb
|
133
150
|
- lib/promiscuous/publisher.rb
|
134
151
|
- lib/promiscuous/railtie.rb
|
135
|
-
- lib/promiscuous/subscriber.rb
|
136
152
|
- lib/promiscuous/worker.rb
|
137
153
|
- lib/promiscuous/common.rb
|
154
|
+
- lib/promiscuous/observer.rb
|
155
|
+
- lib/promiscuous/subscriber.rb
|
138
156
|
- lib/promiscuous/version.rb
|
139
157
|
- lib/promiscuous.rb
|
140
158
|
- README.md
|