Abstracts away different types of notifications objects (ActiveSupport::Notifications
and Dry::Monitor::Notifications
).
Attributes
notifications | [R] |
Public Class methods
new(notifications)
[show source]
# File lib/shrine/plugins/instrumentation.rb 145 def initialize(notifications) 146 @notifications = notifications 147 end
Public Instance methods
instrument(event_name, payload, &block)
[show source]
# File lib/shrine/plugins/instrumentation.rb 155 def instrument(event_name, payload, &block) 156 notifications.instrument(event_name, payload, &block) 157 end
subscribe(event_name, &block)
[show source]
# File lib/shrine/plugins/instrumentation.rb 149 def subscribe(event_name, &block) 150 library_send(:subscribe, event_name) do |event| 151 yield Event.new(event) 152 end 153 end