Class: Materialist::EventHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/materialist/event_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ EventHandler

Returns a new instance of EventHandler.



7
8
9
# File 'lib/materialist/event_handler.rb', line 7

def initialize(options={})
  @options = options
end

Instance Method Details

#call(event) ⇒ Object



15
16
17
# File 'lib/materialist/event_handler.rb', line 15

def call(event)
  worker.perform_async(event)
end

#on_events_received(batch) ⇒ Object



11
12
13
# File 'lib/materialist/event_handler.rb', line 11

def on_events_received(batch)
  batch.each { |event| call(event) if topics.include?(event['topic'].to_s) }
end