Sha256: 6b451cf1c0d98c3a7c820ed9601106295f12e5e1457c27883c9c1798310e6269

Contents?: true

Size: 732 Bytes

Versions: 7

Compression:

Stored size: 732 Bytes

Contents

module UsdaNutrientDatabase
  module Import
    class Footnotes < Base

      private

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

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

      def filename
        'FOOTNOTE.txt'
      end

      def columns
        @columns ||= [
          :nutrient_databank_number, :footnote_number, :footnote_type,
          :nutrient_number, :footnote_text
        ]
      end

      def log_import_started
        UsdaNutrientDatabase.log 'Importing footnotes'
      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/footnotes.rb
usda-nutrient-database-1.0.0 lib/usda_nutrient_database/import/footnotes.rb
usda-nutrient-database-0.8.1 lib/usda_nutrient_database/import/footnotes.rb
usda-nutrient-database-0.8.0 lib/usda_nutrient_database/import/footnotes.rb
usda-nutrient-database-0.7.0 lib/usda_nutrient_database/import/footnotes.rb
usda-nutrient-database-0.6.0 lib/usda_nutrient_database/import/footnotes.rb
usda-nutrient-database-0.5.0 lib/usda_nutrient_database/import/footnotes.rb