Class: Ezlog::Rails::LogSubscriber
- Inherits:
-
Object
- Object
- Ezlog::Rails::LogSubscriber
- Defined in:
- lib/ezlog/rails/log_subscriber.rb
Class Method Summary collapse
Class Method Details
.attach(subscriber_class, namespace) ⇒ Object
16 17 18 |
# File 'lib/ezlog/rails/log_subscriber.rb', line 16 def attach(subscriber_class, namespace) subscriber_class.attach_to namespace end |
.detach(subscriber_class) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/ezlog/rails/log_subscriber.rb', line 5 def detach(subscriber_class) 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 end |