Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

subscriber does not need to be a block, but an object that responds t…

…o #call
  • Loading branch information...
commit 8cbb89c0bf33e6daad3f91c6debd283b979d800c 1 parent b2c8a5f
@tenderlove tenderlove authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 activesupport/lib/active_support/notifications/fanout.rb
View
10 activesupport/lib/active_support/notifications/fanout.rb
@@ -8,9 +8,9 @@ def initialize
@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 @@ def wait
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
Please sign in to comment.
Something went wrong with that request. Please try again.