Sha256: 3e25b8570472ae3fd4b6d14d21453338086d255e4979260345ba221710549c17

Contents?: true

Size: 587 Bytes

Versions: 6

Compression:

Stored size: 587 Bytes

Contents

module UsdaNutrientDatabase
  module Import
    class Nutrients < Base
      def import
        UsdaNutrientDatabase.log 'Importing nutrients'
        CSV.open(
          "#{directory}/NUTR_DEF.txt", 'r:iso-8859-1:utf-8', csv_options
        ) do |csv|
          csv.each do |row|
            UsdaNutrientDatabase::Nutrient.create!(
              nutrient_number: row[0], units: row[1], tagname: row[2],
              nutrient_description: row[3], number_decimal_places: row[4],
              sort_record_order: row[5]
            )
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
usda-nutrient-database-0.4.0 lib/usda_nutrient_database/import/nutrients.rb
usda-nutrient-database-0.3.0 lib/usda_nutrient_database/import/nutrients.rb
usda-nutrient-database-0.2.0 lib/usda_nutrient_database/import/nutrients.rb
usda-nutrient-database-0.1.2 lib/usda_nutrient_database/import/nutrients.rb
usda-nutrient-database-0.1.1 lib/usda_nutrient_database/import/nutrients.rb
usda-nutrient-database-0.1.0 lib/usda_nutrient_database/import/nutrients.rb