Module: EventRouter::Helpers::Event

Included in:
DeliveryAdapters::Helpers::Sidekiq
Defined in:
lib/event_router/helpers/event.rb

Class Method Summary collapse

Class Method Details

.destination_options(destination, adapter) ⇒ Object



25
26
27
# File 'lib/event_router/helpers/event.rb', line 25

def destination_options(destination, adapter)
  adapter.options.merge(destination.options)
end

.event_options(event, adapter) ⇒ Object



19
20
21
22
23
# File 'lib/event_router/helpers/event.rb', line 19

def event_options(event, adapter)
  return adapter.options unless event.options?

  adapter.options.merge(event.options)
end

.yield_destinations(event) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/event_router/helpers/event.rb', line 8

def yield_destinations(event)
  event.destinations.each do |_name, destination|
    if destination.prefetch_payload?
      payload             = destination.extra_payload(event)
      serialized_payload  = EventRouter.serialize(payload)
    end

    yield destination, serialized_payload if block_given?
  end
end