класс ActiveSupport::Notifications::Fanout::Handle
Объект используется для записи времени начала и окончания события.
Оба метода start и finish должны вызываться ровно по одному разу.
В идеале следует использовать блочную форму: ActiveSupport::Notifications.instrument. Handle — это низкоуровневый API, предназначенный для случаев, когда блочная форма не может быть использована.
handle = ActiveSupport::Notifications.instrumenter.build_handle("my.event", {})
begin
handle.start
# work to be instrumented
ensure
handle.finish
end
Публичные методы экземпляра
# File activesupport/lib/active_support/notifications/fanout.rb, line 253 def finish finish_with_values(@name, @id, @payload) end
# File activesupport/lib/active_support/notifications/fanout.rb, line 244
def start
ensure_state! :initialized
@state = :started
iterate_guarding_exceptions(@groups) do |group|
group.start(@name, @id, @payload)
end
end
© 2004–2021 David Heinemeier Hansson
Licensed under the MIT License.