Sha256: e5dfa0a7b0fc4905745d44e0ab295f11af5219ca21ae4d36e0f669f225fcf6e0

Contents?: true

Size: 483 Bytes

Versions: 6

Compression:

Stored size: 483 Bytes

Contents

require 'csv'

module UsdaNutrientDatabase
  module Import
    class FoodGroups < UsdaNutrientDatabase::Import::Base
      def import
        UsdaNutrientDatabase.log 'Importing food groups'
        CSV.open(
          "#{directory}/FD_GROUP.txt", 'r:iso-8859-1:utf-8', csv_options
        ) do |csv|
          csv.each do |row|
            UsdaNutrientDatabase::FoodGroup.create! code: row[0],
              description: row[1]
          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/food_groups.rb
usda-nutrient-database-0.3.0 lib/usda_nutrient_database/import/food_groups.rb
usda-nutrient-database-0.2.0 lib/usda_nutrient_database/import/food_groups.rb
usda-nutrient-database-0.1.2 lib/usda_nutrient_database/import/food_groups.rb
usda-nutrient-database-0.1.1 lib/usda_nutrient_database/import/food_groups.rb
usda-nutrient-database-0.1.0 lib/usda_nutrient_database/import/food_groups.rb