Module: AetherObservatory::Backend::Notifications

Defined in:
lib/aether_observatory/backend/notifications.rb

Class Method Summary collapse

Class Method Details

.instrument(event) ⇒ Object



8
9
10
11
12
# File 'lib/aether_observatory/backend/notifications.rb', line 8

def instrument(event)
  event.names.each do |event_name|
    ActiveSupport::Notifications.instrument(event_name, event)
  end
end

.subscribe(topic, event, *_args) ⇒ Object



14
15
16
17
18
# File 'lib/aether_observatory/backend/notifications.rb', line 14

def subscribe(topic, event, *_args)
  ActiveSupport::Notifications.subscribe(topic) do |*args|
    event.name.constantize.new(ActiveSupport::Notifications::Event.new(*args)).process
  end
end

.unsubscribe(topic) ⇒ Object



20
21
22
# File 'lib/aether_observatory/backend/notifications.rb', line 20

def unsubscribe(topic)
  ActiveSupport::Notifications.unsubscribe(topic)
end