From 74f6ccea201d778e020f8c758013d90ea8a5c8a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 6 Jan 2010 22:23:29 +0100 Subject: instrumenter should be accessible from ActiveSupport::Notifications. --- activesupport/lib/active_support/notifications.rb | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'activesupport/lib/active_support/notifications.rb') diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb index d9bfcbfcab..3e96decb8c 100644 --- a/activesupport/lib/active_support/notifications.rb +++ b/activesupport/lib/active_support/notifications.rb @@ -44,11 +44,16 @@ module ActiveSupport class << self attr_writer :notifier - delegate :publish, :subscribe, :instrument, :to => :notifier + delegate :publish, :subscribe, :to => :notifier + delegate :instrument, :to => :instrumenter def notifier @notifier ||= Notifier.new end + + def instrumenter + Thread.current[:"instrumentation_#{notifier.object_id}"] ||= Instrumenter.new(notifier) + end end class Notifier @@ -67,13 +72,6 @@ module ActiveSupport def wait @queue.wait end - - delegate :instrument, :to => :current_instrumenter - - private - def current_instrumenter - Thread.current[:"instrumentation_#{object_id}"] ||= Notifications::Instrumenter.new(self) - end end end end -- cgit v1.2.3