module MongoBatch

Public Class Methods

in_batches(query, options = {}) click to toggle source
# File lib/mongo_batch.rb, line 38
def self.in_batches(query, options = {})
  Batcher.new(query, options).batches
end

Public Instance Methods

find_in_batches(options = {}, &block) click to toggle source
# File lib/mongo_batch.rb, line 42
def find_in_batches(options = {}, &block)
  batcher = Batcher.new(self, options)

  if block
    batcher.batches.each(&block)
  else
    batcher.batches
  end
end