Class: EntityStore::Substitute
- Inherits:
-
Object
- Object
- EntityStore::Substitute
show all
- Includes:
- EntityStore
- Defined in:
- lib/entity_store/substitute.rb
Constant Summary
Constants included
from EntityStore
Error
Class Method Summary
collapse
Instance Method Summary
collapse
#delete_cache_record, #fetch, included, #new_entity, #next_position, #refresh, #stream_name
Class Method Details
.build ⇒ Object
5
6
7
|
# File 'lib/entity_store/substitute.rb', line 5
def self.build
new
end
|
Instance Method Details
#add(id, entity, version = nil) ⇒ Object
Also known as:
put
20
21
22
23
24
25
26
|
# File 'lib/entity_store/substitute.rb', line 20
def add(id, entity, version=nil)
version ||= 0
record = EntityCache::Record.new id, entity, version
records[id] = record
end
|
#get(id, include: nil) ⇒ Object
9
10
11
12
13
|
# File 'lib/entity_store/substitute.rb', line 9
def get(id, include: nil)
record = records[id]
EntityCache::Record.destructure(record, include)
end
|
#get_version(id) ⇒ Object
15
16
17
18
|
# File 'lib/entity_store/substitute.rb', line 15
def get_version(id)
_, version = get id, include: :version
version
end
|
#records ⇒ Object
29
30
31
|
# File 'lib/entity_store/substitute.rb', line 29
def records
@records ||= {}
end
|