From c045eebd5d35259e65771de159966b7c20690d34 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Fri, 16 Mar 2012 00:54:39 -0300 Subject: Remove deprecation from AS::Deprecation behavior, some minor cleanups * Refactor log subscriber, use select! to avoid a new object * Remove deprecation messages related to AS::Deprecation behavior This was added about 2 years ago for Rails 3: https://github.com/rails/rails/commit/d4c7d3fd94e5a885a6366eaeb3b908bb58ffd4db * Remove some not used requires * Refactor delegate to avoid string conversions and if statements inside each block --- activesupport/lib/active_support/notifications/fanout.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'activesupport/lib/active_support/notifications/fanout.rb') diff --git a/activesupport/lib/active_support/notifications/fanout.rb b/activesupport/lib/active_support/notifications/fanout.rb index a9aa5464e9..4c1b7b2784 100644 --- a/activesupport/lib/active_support/notifications/fanout.rb +++ b/activesupport/lib/active_support/notifications/fanout.rb @@ -9,15 +9,14 @@ module ActiveSupport end def subscribe(pattern = nil, block = Proc.new) - subscriber = Subscriber.new(pattern, block).tap do |s| - @subscribers << s - end + subscriber = Subscriber.new(pattern, block) + @subscribers << subscriber @listeners_for.clear subscriber end def unsubscribe(subscriber) - @subscribers.reject! {|s| s.matches?(subscriber)} + @subscribers.reject! { |s| s.matches?(subscriber) } @listeners_for.clear end -- cgit v1.2.3