aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/notifications
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-07-18 17:20:20 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-07-18 17:20:20 -0700
commit8cbb89c0bf33e6daad3f91c6debd283b979d800c (patch)
tree0ce4595416121961875f87c90369720a2fed5e4b /activesupport/lib/active_support/notifications
parentb2c8a5fd3ea2268022915bb8a7ab449a1502b90d (diff)
downloadrails-8cbb89c0bf33e6daad3f91c6debd283b979d800c.tar.gz
rails-8cbb89c0bf33e6daad3f91c6debd283b979d800c.tar.bz2
rails-8cbb89c0bf33e6daad3f91c6debd283b979d800c.zip
subscriber does not need to be a block, but an object that responds to #call
Diffstat (limited to 'activesupport/lib/active_support/notifications')
-rw-r--r--activesupport/lib/active_support/notifications/fanout.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/notifications/fanout.rb b/activesupport/lib/active_support/notifications/fanout.rb
index 6e4ff40dc3..3bbb9cca44 100644
--- a/activesupport/lib/active_support/notifications/fanout.rb
+++ b/activesupport/lib/active_support/notifications/fanout.rb
@@ -8,9 +8,9 @@ module ActiveSupport
@listeners_for = {}
end
- def subscribe(pattern = nil, &block)
+ def subscribe(pattern = nil, block = Proc.new)
@listeners_for.clear
- Subscriber.new(pattern, &block).tap do |s|
+ Subscriber.new(pattern, block).tap do |s|
@subscribers << s
end
end
@@ -33,14 +33,14 @@ module ActiveSupport
end
class Subscriber #:nodoc:
- def initialize(pattern, &block)
+ def initialize(pattern, delegate)
@pattern = pattern
- @block = block
+ @delegate = delegate
end
def publish(*args)
return unless subscribed_to?(args.first)
- @block.call(*args)
+ @delegate.call(*args)
true
end