Class: PgEventstore::EventClassResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/pg_eventstore/event_class_resolver.rb,
sig/pg_eventstore/event_class_resolver.rbs

Instance Method Summary collapse

Instance Method Details

#call(event_type) ⇒ Class

@param event_type

Parameters:

  • event_type (String, nil)

Returns:

  • (Class)


7
8
9
10
11
12
13
14
15
# File 'lib/pg_eventstore/event_class_resolver.rb', line 7

def call(event_type)
  Object.const_get(event_type)
rescue NameError, TypeError
  PgEventstore.logger&.debug(<<~TEXT.strip)
    Unable to resolve class by `#{event_type}' event type. \
    Picking #{Event} event class to instantiate the event.
  TEXT
  Event
end