Class: ASDeprecationTracker::Receiver
- Inherits:
-
ActiveSupport::Subscriber
- Object
- ActiveSupport::Subscriber
- ASDeprecationTracker::Receiver
- Defined in:
- lib/as_deprecation_tracker/receiver.rb
Overview
Receives deprecation.rails events via ActiveSupport::Notifications
Instance Method Summary collapse
- #deprecation(event) ⇒ Object
-
#initialize ⇒ Receiver
constructor
A new instance of Receiver.
- #process_event(event) ⇒ Object
- #process_queue ⇒ Object
Constructor Details
#initialize ⇒ Receiver
Returns a new instance of Receiver.
9 10 11 12 |
# File 'lib/as_deprecation_tracker/receiver.rb', line 9 def initialize super @event_queue = [] end |
Instance Method Details
#deprecation(event) ⇒ Object
14 15 16 17 |
# File 'lib/as_deprecation_tracker/receiver.rb', line 14 def deprecation(event) @event_queue << event process_queue if ASDeprecationTracker.running? end |
#process_event(event) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/as_deprecation_tracker/receiver.rb', line 23 def process_event(event) return if ASDeprecationTracker.whitelist.matches?(event.payload) = event.payload[:message] callstack = event.payload[:callstack].map(&:to_s) if ASDeprecationTracker.env('RECORD').present? write_deprecation(, callstack) else raise_deprecation(, callstack) end end |
#process_queue ⇒ Object
19 20 21 |
# File 'lib/as_deprecation_tracker/receiver.rb', line 19 def process_queue process_event(@event_queue.pop) until @event_queue.empty? end |