Sha256: 468c3cc044d5c734d025782edbc6aa1d9cbeb5ea7f7c35006148f976a0555b92
Contents?: true
Size: 494 Bytes
Versions: 3
Compression:
Stored size: 494 Bytes
Contents
module EventSourcery module EventStore class EventBuilder def initialize(event_type_serializer:) @event_type_serializer = event_type_serializer end def build(**event_data) type = event_data.fetch(:type) klass = event_type_serializer.deserialize(type) upcast(klass.new(**event_data)) end private attr_reader :event_type_serializer def upcast(event) event.class.upcast(event) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems