ActiveSupport::Notifications::Event
Methods
#
D
N
P
Attributes
[R] children
[RW] end
[R] name
[R] payload
[R] time
[R] transaction_id
Class Public methods
new(name, start, ending, transaction_id, payload)
# File activesupport/lib/active_support/notifications/instrumenter.rb, line 56
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 Public methods
<<(event)
# File activesupport/lib/active_support/notifications/instrumenter.rb, line 82
def <<(event)
  @children << event
end
duration()

Returns the difference in milliseconds between when the execution of the event started and when it ended.

ActiveSupport::Notifications.subscribe('wait') do |*args|
  @event = ActiveSupport::Notifications::Event.new(*args)
end

ActiveSupport::Notifications.instrument('wait') do
  sleep 1
end

@event.duration # => 1000.138
# File activesupport/lib/active_support/notifications/instrumenter.rb, line 78
def duration
  @duration ||= 1000.0 * (self.end - time)
end
parent_of?(event)
# File activesupport/lib/active_support/notifications/instrumenter.rb, line 86
def parent_of?(event)
  @children.include? event
end