class Aruba::EventBus::NameResolver
Resolve name to Event name
def initialize(default_namespace)
def initialize(default_namespace) @default_namespace = default_namespace @resolvers = [] @resolvers << ClassResolver @resolvers << StringResolver @resolvers << SymbolResolver @resolvers << FailingResolver end
def transform(event_id)
def transform(event_id) resolvers.find { |r| r.match? event_id }.new.transform(default_namespace, event_id) rescue StandardError => e types = @resolvers.map(&:supports).flatten.join(", ") message = "Transforming \"#{event_id}\" into an event class failed." \ " Supported types are: #{types}. #{e.message}." raise EventNameResolveError, message, cause: e end