Class: Debugbar::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/debugbar/engine.rb

Instance Method Summary collapse

Instance Method Details

#subscribe(config) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/debugbar/engine.rb', line 83

def subscribe(config)
  config.each do |subscriber, event_names|
    event_names = Array.wrap(event_names)
    class_name, class_method_name = subscriber.split('.')
    event_names.each do |name|
      method_name = class_method_name || name.split('.').first
      ActiveSupport::Notifications.subscribe name do |event|
        class_name.constantize.send method_name, event
      end
    end
  end
end