rails3-footnotes 4.0.0.pre.9 → 4.0.0.pre.10

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ == Footnotes v4.0.0.pre.10 (April 7, 2011)
2
+ * stop the view note collecting events forever
3
+
1
4
  == Footnotes v4.0.0.pre.9 (April 6, 2011)
2
5
  * stop the log note collecting logs forever
3
6
 
@@ -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,3 +1,3 @@
1
1
  module Footnotes
2
- VERSION = "4.0.0.pre.9"
2
+ VERSION = "4.0.0.pre.10"
3
3
  end
@@ -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
- attr_accessor :events
9
+ attr_reader :events
10
+
5
11
  def initialize
6
- @events = Array.new
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
- @events << event.dup
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: 1923831867
4
+ hash: 1923831869
5
5
  prerelease: true
6
6
  segments:
7
7
  - 4
8
8
  - 0
9
9
  - 0
10
10
  - pre
11
- - 9
12
- version: 4.0.0.pre.9
11
+ - 10
12
+ version: 4.0.0.pre.10
13
13
  platform: ruby
14
14
  authors:
15
15
  - "Andr\xC3\xA9 Arko"