aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/notifications
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-07-18 15:39:32 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-07-18 15:39:32 -0700
commit234b9699463ba435086aa253ee143014a835bbe6 (patch)
treedaa30004eda7784aeabd04db5560bb2496639f47 /activesupport/lib/active_support/notifications
parent2cbef6996c41c785a626291ce29b934797359fd2 (diff)
downloadrails-234b9699463ba435086aa253ee143014a835bbe6.tar.gz
rails-234b9699463ba435086aa253ee143014a835bbe6.tar.bz2
rails-234b9699463ba435086aa253ee143014a835bbe6.zip
tap the subscriber for easier return value
Diffstat (limited to 'activesupport/lib/active_support/notifications')
-rw-r--r--activesupport/lib/active_support/notifications/fanout.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/notifications/fanout.rb b/activesupport/lib/active_support/notifications/fanout.rb
index 48ccb156ae..6e4ff40dc3 100644
--- a/activesupport/lib/active_support/notifications/fanout.rb
+++ b/activesupport/lib/active_support/notifications/fanout.rb
@@ -10,8 +10,9 @@ module ActiveSupport
def subscribe(pattern = nil, &block)
@listeners_for.clear
- @subscribers << Subscriber.new(pattern, &block)
- @subscribers.last
+ Subscriber.new(pattern, &block).tap do |s|
+ @subscribers << s
+ end
end
def unsubscribe(subscriber)