Class: Footnotes::Notes::QuerySubscriber
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- Footnotes::Notes::QuerySubscriber
- Defined in:
- lib/rails-footnotes/notes/queries_note.rb
Instance Attribute Summary collapse
-
#events ⇒ Object
Returns the value of attribute events.
Instance Method Summary collapse
-
#initialize(orm) ⇒ QuerySubscriber
constructor
A new instance of QuerySubscriber.
- #reset! ⇒ Object
- #sql(event) ⇒ Object
Constructor Details
#initialize(orm) ⇒ QuerySubscriber
Returns a new instance of QuerySubscriber.
99 100 101 102 |
# File 'lib/rails-footnotes/notes/queries_note.rb', line 99 def initialize(orm) @events = [] orm.each {|adapter| ActiveSupport::LogSubscriber.attach_to adapter, self} end |
Instance Attribute Details
#events ⇒ Object
Returns the value of attribute events.
97 98 99 |
# File 'lib/rails-footnotes/notes/queries_note.rb', line 97 def events @events end |
Instance Method Details
#reset! ⇒ Object
104 105 106 |
# File 'lib/rails-footnotes/notes/queries_note.rb', line 104 def reset! self.events.clear end |
#sql(event) ⇒ Object
108 109 110 |
# File 'lib/rails-footnotes/notes/queries_note.rb', line 108 def sql(event) @events << QuerySubscriberNotifactionEvent.new(event.dup, caller) end |