Sha256: 4758b2d9ffd5ca21de0c74c38df06e79b920d6c51663ae5e40d76188069dcb97

Contents?: true

Size: 576 Bytes

Versions: 5

Compression:

Stored size: 576 Bytes

Contents

module Ezlog
  module Rails
    class LogSubscriber
      def self.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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ezlog-0.3.5 lib/ezlog/rails/log_subscriber.rb
ezlog-0.3.4 lib/ezlog/rails/log_subscriber.rb
ezlog-0.3.3 lib/ezlog/rails/log_subscriber.rb
ezlog-0.3.2 lib/ezlog/rails/log_subscriber.rb
ezlog-0.3.1 lib/ezlog/rails/log_subscriber.rb