Method: CloudKit::MemoryQuery#run
- Defined in:
- lib/cloudkit/store/memory_table.rb
#run(table) ⇒ Object
Run a query against the provided table using the conditions stored in this MemoryQuery instance. Returns all records that match all conditions. Conditions are added using #add_condition.
83 84 85 86 87 88 89 90 91 |
# File 'lib/cloudkit/store/memory_table.rb', line 83 def run(table) table.keys.inject([]) do |result, key| if @conditions.all? { |condition| table[key][condition[0]] == condition[2] } result << table[key].merge(:pk => key) else result end end end |