class Shrine::Plugins::Instrumentation::Notifications

  1. lib/shrine/plugins/instrumentation.rb
Superclass: Object

Abstracts away different types of notifications objects (ActiveSupport::Notifications and Dry::Monitor::Notifications).

Methods

Public Class

  1. new

Public Instance

  1. instrument
  2. notifications
  3. subscribe

Attributes

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