disclosure 0.0.4 → 0.0.5
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/disclosure/engine.rb +5 -3
- data/lib/disclosure/notifications.rb +23 -0
- data/lib/disclosure/version.rb +1 -1
- data/lib/disclosure.rb +3 -0
- metadata +4 -3
data/lib/disclosure/engine.rb
CHANGED
@@ -3,9 +3,11 @@ module Disclosure
|
|
3
3
|
isolate_namespace Disclosure
|
4
4
|
|
5
5
|
initializer 'disclosure.subscribe_to_model_events' do
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
Disclosure::Notifications.subscribe!
|
7
|
+
end
|
8
|
+
|
9
|
+
initializer 'disclosure.instrument_model_events' do
|
10
|
+
Disclosure::Notifications.instrument!
|
9
11
|
end
|
10
12
|
|
11
13
|
initializer 'disclosure.extend_model_classes' do
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Disclosure
|
2
|
+
module Notifications
|
3
|
+
def self.subscribe!
|
4
|
+
ActiveSupport::Notifications.subscribe "disclosure.model_saved" do |name, start, finish, id, payload|
|
5
|
+
Disclosure.react_to!(payload[:model])
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.instrument!
|
10
|
+
Disclosure.configuration.notifier_classes.each do |klass|
|
11
|
+
klass.class_eval do
|
12
|
+
after_commit :notify_disclosure
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def notify_disclosure
|
17
|
+
ActiveSupport::Notifications.instrument("disclosure.model_updated", :model => self)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/disclosure/version.rb
CHANGED
data/lib/disclosure.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: disclosure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -79,6 +79,7 @@ files:
|
|
79
79
|
- lib/disclosure/configuration.rb
|
80
80
|
- lib/disclosure/engine.rb
|
81
81
|
- lib/disclosure/exceptions.rb
|
82
|
+
- lib/disclosure/notifications.rb
|
82
83
|
- lib/disclosure/version.rb
|
83
84
|
- lib/disclosure.rb
|
84
85
|
- lib/tasks/disclosure_tasks.rake
|
@@ -99,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
100
|
version: '0'
|
100
101
|
segments:
|
101
102
|
- 0
|
102
|
-
hash: -
|
103
|
+
hash: -3608972705387088730
|
103
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
105
|
none: false
|
105
106
|
requirements:
|
@@ -108,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
109
|
version: '0'
|
109
110
|
segments:
|
110
111
|
- 0
|
111
|
-
hash: -
|
112
|
+
hash: -3608972705387088730
|
112
113
|
requirements: []
|
113
114
|
rubyforge_project:
|
114
115
|
rubygems_version: 1.8.23
|