Class: Shrine::Plugins::Instrumentation::Event
- Inherits:
-
Object
- Object
- Shrine::Plugins::Instrumentation::Event
- Defined in:
- lib/shrine/plugins/instrumentation.rb
Overview
Abstracts away different kind of event objects (‘ActiveSupport::Notifications::Event` and `Dry::Events::Event`).
Instance Attribute Summary collapse
-
#event ⇒ Object
readonly
Returns the value of attribute event.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #duration ⇒ Object
-
#initialize(event) ⇒ Event
constructor
A new instance of Event.
- #name ⇒ Object
- #payload ⇒ Object
Constructor Details
#initialize(event) ⇒ Event
Returns a new instance of Event.
191 192 193 |
# File 'lib/shrine/plugins/instrumentation.rb', line 191 def initialize(event) @event = event end |
Instance Attribute Details
#event ⇒ Object (readonly)
Returns the value of attribute event.
189 190 191 |
# File 'lib/shrine/plugins/instrumentation.rb', line 189 def event @event end |
Instance Method Details
#[](name) ⇒ Object
203 204 205 |
# File 'lib/shrine/plugins/instrumentation.rb', line 203 def [](name) event.payload.fetch(name) end |
#duration ⇒ Object
207 208 209 |
# File 'lib/shrine/plugins/instrumentation.rb', line 207 def duration library_send(:duration) end |
#name ⇒ Object
195 196 197 |
# File 'lib/shrine/plugins/instrumentation.rb', line 195 def name library_send(:name).chomp(".shrine").to_sym end |
#payload ⇒ Object
199 200 201 |
# File 'lib/shrine/plugins/instrumentation.rb', line 199 def payload event.payload end |