aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorEric Saxby <sax@livinginthepast.org>2012-08-11 17:39:20 -0700
committerEric Saxby <sax@livinginthepast.org>2012-08-11 17:39:20 -0700
commit6fe36ba585d7d60d127b3ba75f923a48c132b3bb (patch)
tree5952b944b2a021c16e87252be1e263e6901826c3 /activesupport/lib/active_support
parenta513cc1862cc61fd9605352a58c5e36cc40cb574 (diff)
downloadrails-6fe36ba585d7d60d127b3ba75f923a48c132b3bb.tar.gz
rails-6fe36ba585d7d60d127b3ba75f923a48c132b3bb.tar.bz2
rails-6fe36ba585d7d60d127b3ba75f923a48c132b3bb.zip
Evented notifications take priority over Timed notifications
In cases where a notification subscriber includes methods to support both Evented and Timed events, Evented should take priority over Timed. This allows subscribers to be backwards compatible (older Rails only allows Timed events) while defaulting to newer behavior.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/notifications/fanout.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/notifications/fanout.rb b/activesupport/lib/active_support/notifications/fanout.rb
index 6ffc091233..2e5bcf4639 100644
--- a/activesupport/lib/active_support/notifications/fanout.rb
+++ b/activesupport/lib/active_support/notifications/fanout.rb
@@ -59,10 +59,10 @@ module ActiveSupport
module Subscribers # :nodoc:
def self.new(pattern, listener)
- if listener.respond_to?(:call)
- subscriber = Timed.new pattern, listener
- else
+ if listener.respond_to?(:start) and listener.respond_to?(:finish)
subscriber = Evented.new pattern, listener
+ else
+ subscriber = Timed.new pattern, listener
end
unless pattern