aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-03-21 13:41:43 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-03-21 16:18:47 -0700
commit6989db9238446838448d8974f6e0934161bd95b9 (patch)
treeeee6f338ddffba522e4cd853d19b0838ba31e3de
parentf08f8750a512f741acb004d0cebe210c5f949f28 (diff)
downloadrails-6989db9238446838448d8974f6e0934161bd95b9.tar.gz
rails-6989db9238446838448d8974f6e0934161bd95b9.tar.bz2
rails-6989db9238446838448d8974f6e0934161bd95b9.zip
evented subscribers work
-rw-r--r--activesupport/lib/active_support/notifications/fanout.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/notifications/fanout.rb b/activesupport/lib/active_support/notifications/fanout.rb
index 8ecafd2b2b..40d7501e1b 100644
--- a/activesupport/lib/active_support/notifications/fanout.rb
+++ b/activesupport/lib/active_support/notifications/fanout.rb
@@ -45,11 +45,15 @@ module ActiveSupport
end
module Subscribers # :nodoc:
- def self.new(pattern, block)
- if pattern
- TimedSubscriber.new pattern, block
+ def self.new(pattern, listener)
+ if listener.respond_to?(:call)
+ if pattern
+ TimedSubscriber.new pattern, listener
+ else
+ AllMessages.new pattern, listener
+ end
else
- AllMessages.new pattern, block
+ Subscriber.new pattern, listener
end
end
@@ -60,11 +64,11 @@ module ActiveSupport
end
def start(name, id, payload)
- raise NotImplementedError
+ @delegate.start name, id, payload
end
def finish(name, id, payload)
- raise NotImplementedError
+ @delegate.finish name, id, payload
end
def subscribed_to?(name)