Sha256: 2e15e3b2a7b9b300fb7a4e4d80d5b9ca55e5409e0e5ea9ca310a4ee61176ebc0

Contents?: true

Size: 589 Bytes

Versions: 28

Compression:

Stored size: 589 Bytes

Contents

# frozen_string_literal: true

module PgEventstore
  # @!visibility private
  class EventSerializer
    attr_reader :middlewares

    # @param middlewares [Array<#deserialize, #serialize>]
    def initialize(middlewares)
      @middlewares = middlewares
    end

    # @param event [PgEventstore::Event]
    # @return [PgEventstore::Event]
    def serialize(event)
      @middlewares.each do |middleware|
        middleware.serialize(event)
      end
      event
    end

    # @return [PgEventstore::EventSerializer]
    def without_middlewares
      self.class.new([])
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
pg_eventstore-1.1.3 lib/pg_eventstore/event_serializer.rb
pg_eventstore-1.1.2 lib/pg_eventstore/event_serializer.rb
pg_eventstore-1.1.1 lib/pg_eventstore/event_serializer.rb
pg_eventstore-1.1.0 lib/pg_eventstore/event_serializer.rb
pg_eventstore-1.0.4 lib/pg_eventstore/event_serializer.rb
pg_eventstore-1.0.0.rc2 lib/pg_eventstore/event_serializer.rb
pg_eventstore-1.0.0.rc1 lib/pg_eventstore/event_serializer.rb
pg_eventstore-0.10.2 lib/pg_eventstore/event_serializer.rb
pg_eventstore-0.10.1 lib/pg_eventstore/event_serializer.rb
pg_eventstore-0.9.0 lib/pg_eventstore/event_serializer.rb
pg_eventstore-0.8.0 lib/pg_eventstore/event_serializer.rb
pg_eventstore-0.7.2 lib/pg_eventstore/event_serializer.rb
pg_eventstore-0.7.1 lib/pg_eventstore/event_serializer.rb
pg_eventstore-0.7.0 lib/pg_eventstore/event_serializer.rb
pg_eventstore-0.6.0 lib/pg_eventstore/event_serializer.rb
pg_eventstore-0.5.3 lib/pg_eventstore/event_serializer.rb
pg_eventstore-0.5.2 lib/pg_eventstore/event_serializer.rb
pg_eventstore-0.5.0 lib/pg_eventstore/event_serializer.rb
pg_eventstore-0.4.0 lib/pg_eventstore/event_serializer.rb
pg_eventstore-0.3.0 lib/pg_eventstore/event_serializer.rb