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
# 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)
end

Instance Method Details

#executeObject



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

def execute
  apply_changes_in_batches
  close_intermediate_files
end