class Datacraft::Tools::Basic::CsvReader
CSV file reader
Public Class Methods
new(csv_file)
click to toggle source
# File lib/datacraft/tools/basic/csv_reader.rb, line 6 def initialize(csv_file) @csv = CSV.open(csv_file, headers: true, header_converters: :symbol) end
Public Instance Methods
each() { |to_hash| ... }
click to toggle source
# File lib/datacraft/tools/basic/csv_reader.rb, line 10 def each @csv.each do |row| yield(row.to_hash) end @csv.close end