Class: Tatami::Couch::BulkImport
- Inherits:
-
Object
- Object
- Tatami::Couch::BulkImport
- Defined in:
- lib/tatami/couch.rb
Instance Method Summary collapse
- #doc_new(attributes) ⇒ Object
- #docs_new ⇒ Object
-
#initialize(couch, limit) {|_self| ... } ⇒ BulkImport
constructor
A new instance of BulkImport.
Constructor Details
#initialize(couch, limit) {|_self| ... } ⇒ BulkImport
Returns a new instance of BulkImport.
214 215 216 217 218 |
# File 'lib/tatami/couch.rb', line 214 def initialize couch, limit @couch, @limit, @cache = couch, limit, [] yield self docs_new end |
Instance Method Details
#doc_new(attributes) ⇒ Object
220 221 222 223 |
# File 'lib/tatami/couch.rb', line 220 def doc_new attributes docs_new if @cache.size > @limit @cache << attributes end |
#docs_new ⇒ Object
225 226 227 228 |
# File 'lib/tatami/couch.rb', line 225 def docs_new @couch.doc_new_bulk @cache @cache = [] end |