class ActiveSupport::Subscriber

def detach_from(namespace, notifier = ActiveSupport::Notifications)

Detach the subscriber from a namespace.
def detach_from(namespace, notifier = ActiveSupport::Notifications)
  @namespace  = namespace
  @subscriber = find_attached_subscriber
  @notifier   = notifier
  return unless subscriber
  subscribers.delete(subscriber)
  # Remove event subscribers of all existing methods on the class.
  fetch_public_methods(subscriber, true).each do |event|
    remove_event_subscriber(event)
  end
  # Reset notifier so that event subscribers will not add for new methods added to the class.
  @notifier = nil
end