Class: CodeSunset::Subscriber
- Inherits:
-
Object
- Object
- CodeSunset::Subscriber
- Defined in:
- lib/code_sunset/subscriber.rb
Class Method Summary collapse
Class Method Details
.subscribe! ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/code_sunset/subscriber.rb', line 4 def subscribe! return @subscription if @subscription @subscription = ActiveSupport::Notifications.subscribe(CodeSunset::Instrumentation::EVENT_NAME) do |_name, _start, _finish, _id, payload| CodeSunset::EventIngestor.ingest(payload) end end |
.subscription ⇒ Object
19 20 21 |
# File 'lib/code_sunset/subscriber.rb', line 19 def subscription @subscription end |
.unsubscribe! ⇒ Object
12 13 14 15 16 17 |
# File 'lib/code_sunset/subscriber.rb', line 12 def unsubscribe! return unless @subscription ActiveSupport::Notifications.unsubscribe(@subscription) @subscription = nil end |