Class: Tire::Model::Import::Strategy::Mongoid

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/tire/model/import.rb

Instance Attribute Summary

Attributes included from Base

#index, #klass, #options

Instance Method Summary collapse

Methods included from Base

#initialize

Instance Method Details

#import(&block) ⇒ Object



64
65
66
67
68
69
70
# File 'lib/tire/model/import.rb', line 64

def import &block
  0.step(klass.count, options[:per_page]) do |offset|
    items = klass.limit(options[:per_page]).skip(offset)
    index.import items.to_a, options, &block
  end
  self
end