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

Extended by:
ActiveSupport::Concern
Included in:
PubSub::Subscribers::Base
Defined in:
lib/support_utils/concerns/pub_sub/subscriber.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#call(message, *args) ⇒ Object

trigger methods when an event is captured



18
19
20
21
22
# 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

#initialize(namespace) ⇒ Object



13
14
15
# File 'lib/support_utils/concerns/pub_sub/subscriber.rb', line 13

def initialize(namespace)
  @namespace = namespace
end