Sha256: cc9999d6ff4b2c9f7e1bbd6208bb1174a990ccf365b32f7352c924aeccf0b534

Contents?: true

Size: 639 Bytes

Versions: 7

Compression:

Stored size: 639 Bytes

Contents

module UsdaNutrientDatabase
  module Import
    class FoodGroups < Base

      private

      def extract_row(row)
        build_food_group(row).save
      end

      def build_food_group(row)
        UsdaNutrientDatabase::FoodGroup.new.tap do |food_group|
          columns.each_with_index do |column, index|
            food_group.send("#{column}=", row[index])
          end
        end
      end

      def columns
        @columns ||= %w(code description)
      end

      def filename
        'FD_GROUP.txt'
      end

      def log_import_started
        UsdaNutrientDatabase.log 'Importing food groups'
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
usda-nutrient-database-1.0.1 lib/usda_nutrient_database/import/food_groups.rb
usda-nutrient-database-1.0.0 lib/usda_nutrient_database/import/food_groups.rb
usda-nutrient-database-0.8.1 lib/usda_nutrient_database/import/food_groups.rb
usda-nutrient-database-0.8.0 lib/usda_nutrient_database/import/food_groups.rb
usda-nutrient-database-0.7.0 lib/usda_nutrient_database/import/food_groups.rb
usda-nutrient-database-0.6.0 lib/usda_nutrient_database/import/food_groups.rb
usda-nutrient-database-0.5.0 lib/usda_nutrient_database/import/food_groups.rb