module DCI::EventRouter

Public Instance Methods

route_events!(events) click to toggle source
# File lib/dci/event_router.rb, line 4
def route_events!(events)
  Array(events).each(&method(:route_event!))
end

Private Instance Methods

dispatch_catching_standard_errors() { || ... } click to toggle source
# File lib/dci/event_router.rb, line 18
def dispatch_catching_standard_errors
  begin
    yield
  rescue StandardError => exception
    DCI.configuration.on_exception_in_router.call(exception) rescue nil

    raise exception if DCI.configuration.raise_in_router
  end
end
route_event!(event) click to toggle source
# File lib/dci/event_router.rb, line 10
def route_event!(event)
  DCI.configuration.routes[event.class].each do |callback|
    dispatch_catching_standard_errors do
      DCI.configuration.router.send(callback, event)
    end
  end
end