Class: CsvPatch::Batches

Inherits:
Object
  • Object
show all
Defined in:
lib/csv_patch/batches.rb

Constant Summary collapse

DEFAULT_BATCH_SIZE =
500

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Batches

Returns a new instance of Batches.



10
11
12
13
14
15
# File 'lib/csv_patch/batches.rb', line 10

def initialize options
  @intermediate_files = []
  @input, @output     = options[:input], options[:output]
  @batches            = StreamBatch.new(options[:changes], options[:batch_size] || DEFAULT_BATCH_SIZE)
  @id_column          = options[:id_column]
end

Instance Method Details

#executeObject



17
18
19
20
# File 'lib/csv_patch/batches.rb', line 17

def execute
  apply_changes_in_batches
  close_intermediate_files
end