Class: DataStore
Instance Method Summary collapse
- #db ⇒ Object
-
#initialize ⇒ DataStore
constructor
A new instance of DataStore.
- #query(collection, query) ⇒ Object
Constructor Details
#initialize ⇒ DataStore
Returns a new instance of DataStore.
4 5 |
# File 'app/volt/tasks/live_query/data_store.rb', line 4 def initialize end |
Instance Method Details
#db ⇒ Object
7 8 9 |
# File 'app/volt/tasks/live_query/data_store.rb', line 7 def db @@db ||= Volt::DataStore.fetch end |
#query(collection, query) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/volt/tasks/live_query/data_store.rb', line 11 def query(collection, query) # Extract query parts query, skip, limit = query cursor = db[collection].find(query) cursor = cursor.skip(skip) if skip cursor = cursor.limit(limit) if limit return cursor.to_a end |