Class: ActiveSupport::Notifications::Event
- Defined in:
- lib/active_support/notifications/instrumenter.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#end ⇒ Object
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
- #<<(event) ⇒ Object
- #duration ⇒ Object
-
#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.
50 51 52 53 54 55 56 57 58 |
# File 'lib/active_support/notifications/instrumenter.rb', line 50 def initialize(name, start, ending, transaction_id, payload) @name = name @payload = payload.dup @time = start @transaction_id = transaction_id @end = ending @children = [] @duration = nil end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
47 48 49 |
# File 'lib/active_support/notifications/instrumenter.rb', line 47 def children @children end |
#end ⇒ Object
Returns the value of attribute end.
48 49 50 |
# File 'lib/active_support/notifications/instrumenter.rb', line 48 def end @end end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
47 48 49 |
# File 'lib/active_support/notifications/instrumenter.rb', line 47 def name @name end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
47 48 49 |
# File 'lib/active_support/notifications/instrumenter.rb', line 47 def payload @payload end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
47 48 49 |
# File 'lib/active_support/notifications/instrumenter.rb', line 47 def time @time end |
#transaction_id ⇒ Object (readonly)
Returns the value of attribute transaction_id.
47 48 49 |
# File 'lib/active_support/notifications/instrumenter.rb', line 47 def transaction_id @transaction_id end |
Instance Method Details
#<<(event) ⇒ Object
64 65 66 |
# File 'lib/active_support/notifications/instrumenter.rb', line 64 def <<(event) @children << event end |
#duration ⇒ Object
60 61 62 |
# File 'lib/active_support/notifications/instrumenter.rb', line 60 def duration @duration ||= 1000.0 * (self.end - time) end |
#parent_of?(event) ⇒ Boolean
68 69 70 |
# File 'lib/active_support/notifications/instrumenter.rb', line 68 def parent_of?(event) @children.include? event end |