Class: Speedup::Collectors::BulletCollector
- Defined in:
- lib/speedup/collectors/bullet_collector.rb
Instance Method Summary collapse
-
#event_to_data(notification) ⇒ Object
use this method to keep convention.
-
#initialize(*attrs) ⇒ BulletCollector
constructor
A new instance of BulletCollector.
- #parse_options ⇒ Object
-
#results ⇒ Object
The data results that are inserted at the end of the request for use in deferred placeholders in the Peek the bar.
- #setup_subscribes ⇒ Object
Methods inherited from Collector
#context_id, #dom_id, #enabled?, #filter_event?, key, #key, #register, #render?, #store_event, #subscribe
Constructor Details
#initialize(*attrs) ⇒ BulletCollector
Returns a new instance of BulletCollector.
5 6 7 8 9 |
# File 'lib/speedup/collectors/bullet_collector.rb', line 5 def initialize(*attrs) require 'bullet' Bullet.enable = true super end |
Instance Method Details
#event_to_data(notification) ⇒ Object
use this method to keep convention
37 38 39 |
# File 'lib/speedup/collectors/bullet_collector.rb', line 37 def event_to_data(notification) {type: notification.class.name.split('::').last, name: notification.title, caller: notification.send(:call_stack_messages), message: notification.body} end |
#parse_options ⇒ Object
12 13 14 |
# File 'lib/speedup/collectors/bullet_collector.rb', line 12 def # pass end |
#results ⇒ Object
The data results that are inserted at the end of the request for use in deferred placeholders in the Peek the bar.
Returns Hash.
20 21 22 |
# File 'lib/speedup/collectors/bullet_collector.rb', line 20 def results {} end |
#setup_subscribes ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/speedup/collectors/bullet_collector.rb', line 24 def setup_subscribes before_request do Bullet.start_request end after_request do Bullet.notification_collector && Bullet.notification_collector.collection.each do |notification| store_event(notification) end Bullet.end_request end end |