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.
189 190 191 |
# File 'lib/shrine/plugins/instrumentation.rb', line 189 def initialize(event) @event = event end |
Instance Attribute Details
#event ⇒ Object (readonly)
Returns the value of attribute event.
187 188 189 |
# File 'lib/shrine/plugins/instrumentation.rb', line 187 def event @event end |
Instance Method Details
#[](name) ⇒ Object
201 202 203 |
# File 'lib/shrine/plugins/instrumentation.rb', line 201 def [](name) event.payload.fetch(name) end |
#duration ⇒ Object
205 206 207 |
# File 'lib/shrine/plugins/instrumentation.rb', line 205 def duration library_send(:duration) end |
#name ⇒ Object
193 194 195 |
# File 'lib/shrine/plugins/instrumentation.rb', line 193 def name library_send(:name).chomp(".shrine").to_sym end |
#payload ⇒ Object
197 198 199 |
# File 'lib/shrine/plugins/instrumentation.rb', line 197 def payload event.payload end |