lib/active_support/notifications.rb in activesupport-4.1.16 vs lib/active_support/notifications.rb in activesupport-4.2.0.beta1
- old
+ new
@@ -139,10 +139,15 @@
# To prevent that block from being called anymore, just unsubscribe passing
# that reference:
#
# ActiveSupport::Notifications.unsubscribe(subscriber)
#
+ # You can also unsubscribe by passing the name of the subscriber object. Note
+ # that this will unsubscribe all subscriptions with the given name:
+ #
+ # ActiveSupport::Notifications.unsubscribe("render")
+ #
# == Default Queue
#
# Notifications ships with a queue implementation that consumes and publishes events
# to all log subscribers. You can use any queue implementation you want.
#
@@ -171,11 +176,11 @@
yield
ensure
unsubscribe(subscriber)
end
- def unsubscribe(args)
- notifier.unsubscribe(args)
+ def unsubscribe(subscriber_or_name)
+ notifier.unsubscribe(subscriber_or_name)
end
def instrumenter
InstrumentationRegistry.instance.instrumenter_for(notifier)
end