mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Update documentation to reflect unsubscription with name.
This commit is contained in:
parent
02ee081cd6
commit
a67fdc0256
2 changed files with 9 additions and 4 deletions
|
@ -141,6 +141,11 @@ module ActiveSupport
|
|||
#
|
||||
# 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
|
||||
|
@ -173,8 +178,8 @@ module ActiveSupport
|
|||
unsubscribe(subscriber)
|
||||
end
|
||||
|
||||
def unsubscribe(args)
|
||||
notifier.unsubscribe(args)
|
||||
def unsubscribe(subscriber_or_name)
|
||||
notifier.unsubscribe(subscriber_or_name)
|
||||
end
|
||||
|
||||
def instrumenter
|
||||
|
|
|
@ -25,9 +25,9 @@ module ActiveSupport
|
|||
subscriber
|
||||
end
|
||||
|
||||
def unsubscribe(subscriber)
|
||||
def unsubscribe(subscriber_or_name)
|
||||
synchronize do
|
||||
@subscribers.reject! { |s| s.matches?(subscriber) }
|
||||
@subscribers.reject! { |s| s.matches?(subscriber_or_name) }
|
||||
@listeners_for.clear
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue