Sha256: 269025efa5525c63e09ca4d2e51ed088bf883243a4b21f0e176914890d0d3a28

Contents?: true

Size: 413 Bytes

Versions: 4

Compression:

Stored size: 413 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)
        klass.new(event_data)
      end

      private

      attr_reader :event_type_serializer
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
event_sourcery-0.16.1 lib/event_sourcery/event_store/event_builder.rb
event_sourcery-0.15.0 lib/event_sourcery/event_store/event_builder.rb
event_sourcery-0.14.0 lib/event_sourcery/event_store/event_builder.rb
event_sourcery-0.13.0 lib/event_sourcery/event_store/event_builder.rb