diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-09 14:02:38 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-09 14:02:38 -0800 |
commit | 3e02b3702ec640a521214109646bdebb5216bf96 (patch) | |
tree | 0ea1cf7e669d206ad8ab94ebde2dab7932e45c07 /activesupport/lib/active_support | |
parent | e50d43a2017bea8088ecf7aab7fa632f9b80f77f (diff) | |
download | rails-3e02b3702ec640a521214109646bdebb5216bf96.tar.gz rails-3e02b3702ec640a521214109646bdebb5216bf96.tar.bz2 rails-3e02b3702ec640a521214109646bdebb5216bf96.zip |
just use an attr_accessor so we do not pay ||= on every notification call
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/notifications.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb index 116f28d360..30daf9dafc 100644 --- a/activesupport/lib/active_support/notifications.rb +++ b/activesupport/lib/active_support/notifications.rb @@ -44,7 +44,7 @@ module ActiveSupport @instrumenters = Hash.new { |h,k| h[k] = notifier.listening?(k) } class << self - attr_writer :notifier + attr_accessor :notifier def publish(name, *args) notifier.publish(name, *args) @@ -69,13 +69,11 @@ module ActiveSupport @instrumenters.clear end - def notifier - @notifier ||= Fanout.new - end - def instrumenter Thread.current[:"instrumentation_#{notifier.object_id}"] ||= Instrumenter.new(notifier) end end + + self.notifier = Fanout.new end end |