rails3-footnotes 4.0.0.pre.9 → 4.0.0.pre.10
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/CHANGELOG +3 -0
- data/lib/rails-footnotes.rb +7 -0
- data/lib/rails-footnotes/version.rb +1 -1
- data/lib/rails-footnotes/view_subscriber.rb +13 -6
- metadata +3 -3
data/CHANGELOG
CHANGED
data/lib/rails-footnotes.rb
CHANGED
@@ -21,6 +21,13 @@ module Footnotes
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
config.to_prepare do
|
25
|
+
if ::Rails.env.development?
|
26
|
+
# Right so we should reset the events for each request
|
27
|
+
Footnotes.view_subscriber.reset!
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
24
31
|
# Hook into the logger so we can collect logs
|
25
32
|
initializer "rails3-footnotes.hook_logger" do
|
26
33
|
if ::Rails.env.development?
|
@@ -1,14 +1,24 @@
|
|
1
1
|
# Class that can subscribe to and log any view events
|
2
2
|
module Footnotes
|
3
|
+
|
4
|
+
def self.view_subscriber
|
5
|
+
@view_subscriber ||= ViewSubscriber.new
|
6
|
+
end
|
7
|
+
|
3
8
|
class ViewSubscriber < ActiveSupport::LogSubscriber
|
4
|
-
|
9
|
+
attr_reader :events
|
10
|
+
|
5
11
|
def initialize
|
6
|
-
|
12
|
+
reset!
|
7
13
|
super
|
8
14
|
end
|
9
15
|
|
16
|
+
def reset!
|
17
|
+
@events = []
|
18
|
+
end
|
19
|
+
|
10
20
|
def render_template(event)
|
11
|
-
|
21
|
+
events << event.dup
|
12
22
|
end
|
13
23
|
alias :render_partial :render_template
|
14
24
|
alias :render_collection :render_template
|
@@ -38,7 +48,4 @@ module Footnotes
|
|
38
48
|
end
|
39
49
|
end
|
40
50
|
|
41
|
-
def self.view_subscriber
|
42
|
-
@view_subscriber ||= ViewSubscriber.new
|
43
|
-
end
|
44
51
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails3-footnotes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1923831869
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 4
|
8
8
|
- 0
|
9
9
|
- 0
|
10
10
|
- pre
|
11
|
-
-
|
12
|
-
version: 4.0.0.pre.
|
11
|
+
- 10
|
12
|
+
version: 4.0.0.pre.10
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- "Andr\xC3\xA9 Arko"
|