Sha256: 36a96e825649541fa0093ac2ad0c094796e9e49ffc5ad7d2e3a07d2c5efd8fdc

Contents?: true

Size: 520 Bytes

Versions: 13

Compression:

Stored size: 520 Bytes

Contents

class Cranium::Extract::Strategy::Incremental < Cranium::Extract::Strategy::Base

  protected

  def write_dataset_into_file(target_file, dataset, extract_definition)
    incremental_field, max_value = extract_definition.incrementally_by, nil

    dataset.each do |row|
      max_value = row[incremental_field] if max_value.nil? or row[incremental_field] > max_value
      target_file << row.values
    end

    extract_definition.storage.save_last_value_of incremental_field, max_value unless max_value.nil?
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cranium-0.8.1 lib/cranium/extract/strategy/incremental.rb
cranium-0.8 lib/cranium/extract/strategy/incremental.rb
cranium-0.7 lib/cranium/extract/strategy/incremental.rb
cranium-0.6.1 lib/cranium/extract/strategy/incremental.rb
cranium-0.5 lib/cranium/extract/strategy/incremental.rb
cranium-0.4.3 lib/cranium/extract/strategy/incremental.rb
cranium-0.4.2 lib/cranium/extract/strategy/incremental.rb
cranium-0.4.1 lib/cranium/extract/strategy/incremental.rb
cranium-0.4 lib/cranium/extract/strategy/incremental.rb
cranium-0.3.1 lib/cranium/extract/strategy/incremental.rb
cranium-0.3.0 lib/cranium/extract/strategy/incremental.rb
cranium-0.2.1 lib/cranium/extract/strategy/incremental.rb
cranium-0.2.0 lib/cranium/extract/strategy/incremental.rb