Class: Vizsla::Subscribers
- Inherits:
-
Object
- Object
- Vizsla::Subscribers
- Defined in:
- lib/vizsla/subscribers.rb
Instance Method Summary collapse
-
#collect_events_data ⇒ Object
—————————=== Aux ===—————————===.
-
#initialize ⇒ Subscribers
constructor
A new instance of Subscribers.
-
#postgres_hook ⇒ Object
—————————=== Non-Rails Hooks ===—————————===.
- #process_action_hook ⇒ Object
- #render_template_hook ⇒ Object
- #report_events_data ⇒ Object
- #sql_hook ⇒ Object
Constructor Details
#initialize ⇒ Subscribers
Returns a new instance of Subscribers.
70 71 72 73 |
# File 'lib/vizsla/subscribers.rb', line 70 def initialize @events_data = Recorder collect_events_data end |
Instance Method Details
#collect_events_data ⇒ Object
—————————===
Aux
—————————===
116 117 118 119 120 121 |
# File 'lib/vizsla/subscribers.rb', line 116 def collect_events_data sql_hook process_action_hook render_template_hook postgres_hook end |
#postgres_hook ⇒ Object
—————————===
Non-Rails Hooks
—————————===
103 104 105 106 107 108 109 110 |
# File 'lib/vizsla/subscribers.rb', line 103 def postgres_hook unless rails_app? ::Vizsla::Patches.patch_postgres do |event_data| event = SQLEvent.new event_data @events_data << event end end end |
#process_action_hook ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/vizsla/subscribers.rb', line 83 def process_action_hook return unless rails_app? ActiveSupport::Notifications.subscribe "process_action.action_controller" do |*args| event = ControllerEvent.new(args) @events_data << event end end |
#render_template_hook ⇒ Object
91 92 93 94 95 96 97 |
# File 'lib/vizsla/subscribers.rb', line 91 def render_template_hook return unless rails_app? ActiveSupport::Notifications.subscribe "render_template.action_view" do |*args| event = ViewEvent.new(args) @events_data << event end end |
#report_events_data ⇒ Object
123 124 125 |
# File 'lib/vizsla/subscribers.rb', line 123 def report_events_data @logger.log_events(@events_data) end |