class ActiveSupport::Subscriber

def attach_to(namespace, subscriber=new, notifier=ActiveSupport::Notifications)

Attach the subscriber to a namespace.
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