Module: Docsmith::Events::Notifier

Defined in:
lib/docsmith/events/notifier.rb

Overview

Fires both AS::Notifications and callback hooks for every action. Instrument name format: "#event_name.docsmith" (e.g. "version_created.docsmith").

Class Method Summary collapse

Class Method Details

.instrument(event_name, **payload) ⇒ Docsmith::Events::Event

Parameters:

  • event_name (Symbol)
  • payload (Hash)

    keyword args forwarded to Event.new

Returns:



13
14
15
16
17
18
19
# File 'lib/docsmith/events/notifier.rb', line 13

def self.instrument(event_name, **payload)
  event = Event.new(**payload)
  ActiveSupport::Notifications.instrument("#{event_name}.docsmith", payload) do
    HookRegistry.call(event_name, event)
  end
  event
end