Class: ActiveSupport::Notifications::Event
- Defined in:
- activesupport/lib/active_support/notifications/instrumenter.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#end ⇒ Object
readonly
Returns the value of attribute end.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#transaction_id ⇒ Object
readonly
Returns the value of attribute transaction_id.
Instance Method Summary collapse
-
#initialize(name, start, ending, transaction_id, payload) ⇒ Event
constructor
A new instance of Event.
- #parent_of?(event) ⇒ Boolean
Constructor Details
#initialize(name, start, ending, transaction_id, payload) ⇒ Event
Returns a new instance of Event.
38 39 40 41 42 43 44 45 |
# File 'activesupport/lib/active_support/notifications/instrumenter.rb', line 38 def initialize(name, start, ending, transaction_id, payload) @name = name @payload = payload.dup @time = start @transaction_id = transaction_id @end = ending @duration = 1000.0 * (@end - @time) end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration
36 37 38 |
# File 'activesupport/lib/active_support/notifications/instrumenter.rb', line 36 def duration @duration end |
#end ⇒ Object (readonly)
Returns the value of attribute end
36 37 38 |
# File 'activesupport/lib/active_support/notifications/instrumenter.rb', line 36 def end @end end |
#name ⇒ Object (readonly)
Returns the value of attribute name
36 37 38 |
# File 'activesupport/lib/active_support/notifications/instrumenter.rb', line 36 def name @name end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload
36 37 38 |
# File 'activesupport/lib/active_support/notifications/instrumenter.rb', line 36 def payload @payload end |
#time ⇒ Object (readonly)
Returns the value of attribute time
36 37 38 |
# File 'activesupport/lib/active_support/notifications/instrumenter.rb', line 36 def time @time end |
#transaction_id ⇒ Object (readonly)
Returns the value of attribute transaction_id
36 37 38 |
# File 'activesupport/lib/active_support/notifications/instrumenter.rb', line 36 def transaction_id @transaction_id end |
Instance Method Details
#parent_of?(event) ⇒ Boolean
47 48 49 50 |
# File 'activesupport/lib/active_support/notifications/instrumenter.rb', line 47 def parent_of?(event) start = (time - event.time) * 1000 start <= 0 && (start + duration >= event.duration) end |