Sha256: c831a885bea7719e99d6ffe0dc21b68ee244b0fe167bf9bf7bbafd178ca2a85b
Contents?: true
Size: 490 Bytes
Versions: 7
Compression:
Stored size: 490 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
7 entries across 7 versions & 1 rubygems