Module: SupportUtils::Concerns::PubSub::Subscriber::ClassMethods

Defined in:
lib/support_utils/concerns/pub_sub/subscriber.rb

Instance Method Summary collapse

Instance Method Details

#subscribe_to(namespace) ⇒ Object

attach public methods of subscriber with events in the namespace



27
28
29
30
31
32
# File 'lib/support_utils/concerns/pub_sub/subscriber.rb', line 27

def subscribe_to(namespace)
  log_subscriber = new(namespace)
  log_subscriber.public_methods(false).each do |event|
    ActiveSupport::Notifications.subscribe("#{namespace}.#{event}", log_subscriber)
  end
end