Sha256: 505b966f6a0c0922949fe0bcf6efe3c6a5fd9d0d90482433944f4536f8e6a291

Contents?: true

Size: 317 Bytes

Versions: 3

Compression:

Stored size: 317 Bytes

Contents

require 'csv'

module DataSeeder
  module Loader
    class CSV
      include Loader

      def line_number
        # Don't count the header
        $INPUT_LINE_NUMBER-1
      end

      def load(io)
        ::CSV.foreach(io, headers: true) do |row|
          save(row.to_hash)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
data_seeder-0.0.4 lib/data_seeder/loader/csv.rb
data_seeder-0.0.3 lib/data_seeder/loader/csv.rb
data_seeder-0.0.2 lib/data_seeder/loader/csv.rb