module SupportUtils::Concerns::PubSub::Subscriber

Public Class Methods

new(namespace) click to toggle source
# File lib/support_utils/concerns/pub_sub/subscriber.rb, line 13
def initialize(namespace)
  @namespace = namespace
end

Public Instance Methods

call(message, *args) click to toggle source

trigger methods when an event is captured

# File lib/support_utils/concerns/pub_sub/subscriber.rb, line 18
def call(message, *args)
  method  = message.gsub("#{namespace}.", '')
  handler = self.class.new(namespace)
  handler.send(method, ActiveSupport::Notifications::Event.new(message, *args))
end