Sha256: 469c6227e4469f3d2ee8a19073652777ebfc310d3a17d7839b678729ce989ab2
Contents?: true
Size: 569 Bytes
Versions: 13
Compression:
Stored size: 569 Bytes
Contents
module Superstore module Batches def find_each(options = {}) batch_size = options[:batch_size] || 1000 klass.adapter.scroll(self, batch_size) do |key, attributes| yield klass.instantiate(key, attributes) end end def find_in_batches(options = {}) batch_size = options[:batch_size] || 1000 batch = [] find_each(options) do |record| batch << record if batch.size == batch_size yield batch batch = [] end end yield(batch) if batch.any? end end end
Version data entries
13 entries across 13 versions & 1 rubygems