Class: MassInsert::Process
- Inherits:
-
Object
- Object
- MassInsert::Process
- Defined in:
- lib/mass_insert/process.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(values, options) ⇒ Process
constructor
A new instance of Process.
- #start ⇒ Object
Constructor Details
#initialize(values, options) ⇒ Process
Returns a new instance of Process.
5 6 7 8 |
# File 'lib/mass_insert/process.rb', line 5 def initialize(values, ) @values = values @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/mass_insert/process.rb', line 3 def @options end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
3 4 5 |
# File 'lib/mass_insert/process.rb', line 3 def values @values end |
Instance Method Details
#start ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/mass_insert/process.rb', line 10 def start ActiveRecord::Base.transaction do values.each_slice(per_batch).each do |batch| query = builder.build(batch, ) executer.execute(query) end end end |