| Class | Rddb::DocumentStore::RamDocumentStore |
| In: |
lib/rddb/document_store/ram_document_store.rb
|
| Parent: | Base |
DocumentStore implementation that stores documents in a Hash in memory.
Initialize the datastore.
# File lib/rddb/document_store/ram_document_store.rb, line 7 7: def initialize(options={}) 8: @options = options 9: end
The number of documents in the datastore
# File lib/rddb/document_store/ram_document_store.rb, line 32
32: def count
33: documents.length
34: end
Delete the document at the given path.
# File lib/rddb/document_store/ram_document_store.rb, line 22
22: def delete(id)
23: documents.delete(id.to_s)
24: end
Return true if the document exists.
# File lib/rddb/document_store/ram_document_store.rb, line 27
27: def exists?(id)
28: documents.key?(id.to_s)
29: end
Find the document for the given id.
# File lib/rddb/document_store/ram_document_store.rb, line 12
12: def find(id)
13: documents[id.to_s]
14: end