# File lib/rufus/cloche.rb, line 178 def get_many (type, key_match=nil, opts={}) opts = opts.inject({}) { |h, (k, v)| h[k.to_s] = v; h } d = dir_for(type) return [] unless File.exist?(d) docs = [] limit = opts['limit'] files = Dir[File.join(d, '**', '*.json')].sort { |p0, p1| File.basename(p0) <=> File.basename(p1) } files.each do |fn| key = File.basename(fn, '.json') if (not key_match) || key.match(key_match) doc = get(type, key) docs << doc if doc break if limit && (docs.size >= limit) end end # WARNING : there is a twist here, the filenames may have a different # sort order from actual _ids... #docs.sort { |doc0, doc1| doc0['_id'] <=> doc1['_id'] } # let's trust filename order docs end