lib/data_seeder/loader/csv.rb in data_seeder-0.0.4 vs lib/data_seeder/loader/csv.rb in data_seeder-0.0.5

- old
+ new

@@ -3,16 +3,15 @@ module DataSeeder module Loader class CSV include Loader - def line_number - # Don't count the header - $INPUT_LINE_NUMBER-1 - end + attr_reader :line_number def load(io) + @line_number = 0 ::CSV.foreach(io, headers: true) do |row| + @line_number += 1 save(row.to_hash) end end end end