Sha256: 165947a25d830c821f822e12e24c14bc9e431a5aa797c1f43826e97087d7e4be

Contents?: true

Size: 779 Bytes

Versions: 10

Compression:

Stored size: 779 Bytes

Contents

module Euston
  module EventStore
    module Persistence
      module Mongodb
        module MongoEventMessage
          extend ::ActiveSupport::Concern

          class << self
            def from_hash(hash)
              {}.recursive_symbolize_keys!
              message = EventMessage.new hash['body'].recursive_symbolize_keys!
              message.instance_variable_set :@headers, hash['headers'].recursive_symbolize_keys!
              message
            end
          end

          def to_hash
            {
              :headers => headers,
              :body => body.to_hash.recursive_stringify_symbol_values!
            }
          end
        end
      end
    end

    class EventMessage
      include Persistence::Mongodb::MongoEventMessage
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
euston-eventstore-1.1.0 lib/euston-eventstore/persistence/mongodb/mongo_event_message.rb
euston-eventstore-1.1.0-java lib/euston-eventstore/persistence/mongodb/mongo_event_message.rb
euston-eventstore-1.0.4-java lib/euston-eventstore/persistence/mongodb/mongo_event_message.rb
euston-eventstore-1.0.4 lib/euston-eventstore/persistence/mongodb/mongo_event_message.rb
euston-eventstore-1.0.3-java lib/euston-eventstore/persistence/mongodb/mongo_event_message.rb
euston-eventstore-1.0.3 lib/euston-eventstore/persistence/mongodb/mongo_event_message.rb
euston-eventstore-1.0.2-java lib/euston-eventstore/persistence/mongodb/mongo_event_message.rb
euston-eventstore-1.0.2 lib/euston-eventstore/persistence/mongodb/mongo_event_message.rb
euston-eventstore-1.0.1 lib/euston-eventstore/persistence/mongodb/mongo_event_message.rb
euston-eventstore-1.0.0 lib/euston-eventstore/persistence/mongodb/mongo_event_message.rb