diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-18 15:39:32 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-18 15:39:32 -0700 |
commit | 234b9699463ba435086aa253ee143014a835bbe6 (patch) | |
tree | daa30004eda7784aeabd04db5560bb2496639f47 /activesupport | |
parent | 2cbef6996c41c785a626291ce29b934797359fd2 (diff) | |
download | rails-234b9699463ba435086aa253ee143014a835bbe6.tar.gz rails-234b9699463ba435086aa253ee143014a835bbe6.tar.bz2 rails-234b9699463ba435086aa253ee143014a835bbe6.zip |
tap the subscriber for easier return value
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/notifications/fanout.rb | 5 |
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) |