Class: Jouba::EventStore

Inherits:
MemoryStore show all
Defined in:
lib/jouba/store.rb

Defined Under Namespace

Classes: Collection

Instance Attribute Summary

Attributes inherited from MemoryStore

#db

Instance Method Summary collapse

Methods inherited from MemoryStore

#delete, #initialize, load, #persist

Constructor Details

This class inherits a constructor from Jouba::MemoryStore

Instance Method Details

#flushObject



72
73
74
# File 'lib/jouba/store.rb', line 72

def flush
  @db = Hash.new { |h, k| h[k] = [] }
end

#get(key, _ = {}) ⇒ Object



64
65
66
# File 'lib/jouba/store.rb', line 64

def get(key, _ = {})
  Collection.new db[key].map { |item| deserialize(item) }
end

#set(key, value) ⇒ Object



68
69
70
# File 'lib/jouba/store.rb', line 68

def set(key, value)
  db[key].push serialize(value)
end