module Hikki module Adapters class Adapter attr_reader :collections def initialize @collections = {} end def index(collection, field) collection_for(collection).index(field) end def save(collection, data) collection_for(collection).save(data) end def find(collection, id) collection_for(collection).find(id) end def all(collection, options={}) collection_for(collection).all(options) end def find_by(collection, field, value, options={}) collection_for(collection).find_by(field, value, options) end def remove(collection, id) collection_for(collection).remove(id) end def remove_all(collection) collection_for(collection).remove_all end def collection_for(collection) collections.fetch(collection, Collection.new(collection, store, uuid_generator)) end end end end