demo/my_functions.rb
# Read a CSV file into an array of hashes with the symbolized headers as keys
# Column separator is a colon.
Read a CSV file into an array of hashes with the symbolized headers as keys
Column separator is a colon.
Read a CSV file into an array of hashes with the symbolized headers as keys Column separator is a colon .
def read_csv( path )
      File.open(path) do |f|
        csv = CSV.new(f, :col_sep => ';', :headers => true, :header_converters => :symbol, :converters => [:all])
        csv.to_a.map {|row| row.to_hash }
      end
    end
def read_csv ( path ) File . open ( path ) do | f | csv = CSV . new ( f , :col_sep => ';' , :headers => true , :header_converters => :symbol , :converters => [ :all ] ) csv . to_a . map { | row | row . to_hash } end end
Read a CSV file into an array of hashes with the symbolized headers as keys
Column separator is a colon.
Read a CSV file into an array of hashes with the symbolized headers as keys Column separator is a colon .
path
<not_specific>