9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/logcraft/rails/log_subscription_handler.rb', line 9
def detach(subscriber_class, namespace)
case ::Rails::VERSION::MAJOR
when 5
subscriber = ::ActiveSupport::LogSubscriber.log_subscribers.find { |subscriber| subscriber.is_a? subscriber_class }
return unless subscriber
subscriber.patterns.each do |pattern|
::ActiveSupport::Notifications.notifier.listeners_for(pattern).each do |listener|
::ActiveSupport::Notifications.unsubscribe listener if listener.instance_variable_get('@delegate').is_a? subscriber_class
end
end
else
subscriber_class.detach_from namespace
end
end
|