Add ability to override the way how event class is resolved from event type.
Previously the event was resolved from an event type only in the pre-defined way - Object.const_get(event_type)
. Current release adds an ability to add your own resolver using config.event_class_resolver
config option. You should define a Proc
that accepts a string and returns a class. Example:
EventStoreClient.configure do |config|
config.event_class_resolver = proc { |event_type| event_type == 'some-event' ? SomeEvent : AnotherEvent }
end
If config.event_class_resolver
returns nil
- config.default_event_class
class will be picked.