class method
self.attach_to
Ruby on Rails 4.0.13
Since v4.0.13Signature
self.attach_to(namespace, subscriber=new, notifier=ActiveSupport::Notifications)
Attach the subscriber to a namespace.
Parameters
-
namespacereq -
subscriberopt = new -
notifieropt = ActiveSupport::Notifications
Source
# File activesupport/lib/active_support/subscriber.rb, line 33
def attach_to(namespace, subscriber=new, notifier=ActiveSupport::Notifications)
subscribers << subscriber
subscriber.public_methods(false).each do |event|
next if %w{ start finish }.include?(event.to_s)
notifier.subscribe("#{event}.#{namespace}", subscriber)
end
end
Defined in activesupport/lib/active_support/subscriber.rb line 33
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Subscriber