Class: Shrine::Plugins::Instrumentation::Notifications
- Inherits:
-
Object
- Object
- Shrine::Plugins::Instrumentation::Notifications
- Defined in:
- lib/shrine/plugins/instrumentation.rb
Overview
Abstracts away different types of notifications objects (‘ActiveSupport::Notifications` and `Dry::Monitor::Notifications`).
Instance Attribute Summary collapse
-
#notifications ⇒ Object
readonly
Returns the value of attribute notifications.
Instance Method Summary collapse
-
#initialize(notifications) ⇒ Notifications
constructor
A new instance of Notifications.
- #instrument(event_name, payload, &block) ⇒ Object
- #subscribe(event_name, &block) ⇒ Object
Constructor Details
#initialize(notifications) ⇒ Notifications
Returns a new instance of Notifications.
138 139 140 |
# File 'lib/shrine/plugins/instrumentation.rb', line 138 def initialize(notifications) @notifications = notifications end |
Instance Attribute Details
#notifications ⇒ Object (readonly)
Returns the value of attribute notifications.
136 137 138 |
# File 'lib/shrine/plugins/instrumentation.rb', line 136 def notifications @notifications end |
Instance Method Details
#instrument(event_name, payload, &block) ⇒ Object
148 149 150 |
# File 'lib/shrine/plugins/instrumentation.rb', line 148 def instrument(event_name, payload, &block) notifications.instrument(event_name, payload, &block) end |