class Tatami::Couch::BulkImport

Public Class Methods

new(couch, limit) { |self| ... } click to toggle source
# File lib/tatami/couch.rb, line 214
def initialize couch, limit
  @couch, @limit, @cache = couch, limit, []
  yield self
  docs_new
end

Public Instance Methods

doc_new(attributes) click to toggle source
# File lib/tatami/couch.rb, line 220
def doc_new attributes
  docs_new if @cache.size > @limit
  @cache << attributes
end
docs_new() click to toggle source
# File lib/tatami/couch.rb, line 225
def docs_new
  @couch.doc_new_bulk @cache
  @cache = []
end