Module: Euston::EventStore::Persistence::Mongodb::MongoStreamHead

Extended by:
ActiveSupport::Concern
Included in:
StreamHead
Defined in:
lib/euston-eventstore/persistence/mongodb/mongo_stream_head.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_hash(hash) ⇒ Object



9
10
11
12
# File 'lib/euston-eventstore/persistence/mongodb/mongo_stream_head.rb', line 9

def from_hash hash
  return nil if hash.nil?
  StreamHead.new hash['_id'], hash['head_revision'], hash['snapshot_revision']
end

Instance Method Details

#to_hashObject



15
16
17
18
19
20
21
# File 'lib/euston-eventstore/persistence/mongodb/mongo_stream_head.rb', line 15

def to_hash
  {
    :stream_id => @stream_id,
    :head_revision => @head_revision,
    :snapshot_revision => @snapshot_revision
  }
end