class ActiveSupport::Notifications::Event
Атрибуты
children[R]
end[RW]
name[R]
payload[R]
time[R]
transaction_id[R]
Общедоступные методы класса
# File activesupport/lib/active_support/notifications/instrumenter.rb, line 58 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
Общедоступные методы экземпляра
# File activesupport/lib/active_support/notifications/instrumenter.rb, line 84 def <<(event) @children << event end
# File activesupport/lib/active_support/notifications/instrumenter.rb, line 80 def duration @duration ||= 1000.0 * (self.end - time) end
Возвращает разницу в миллисекундах между началом и окончанием выполнения события.
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 88 def parent_of?(event) @children.include? event end
© 2004–2018 David Heinemeier Hansson
Licensed under the MIT License.