Class: PubSub::EventHandlerBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/pub_sub/event_handler_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(class_name, subscription_type) ⇒ EventHandlerBuilder

Returns a new instance of EventHandlerBuilder.



3
4
5
6
# File 'lib/pub_sub/event_handler_builder.rb', line 3

def initialize(class_name, subscription_type)
  @class_name = class_name
  @subscription_type = subscription_type.to_sym
end

Instance Method Details

#call(event) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/pub_sub/event_handler_builder.rb', line 8

def call(event)
  if async?
    EventWorker.perform_async(class_name.to_s, event.event_id)
  else
    class_name.new(event).call!
  end
end