Skip to content

Instantly share code, notes, and snippets.

@dkubb
Created January 22, 2009 19:10
Show Gist options
  • Save dkubb/50671 to your computer and use it in GitHub Desktop.
Save dkubb/50671 to your computer and use it in GitHub Desktop.
header = nil
FasterCSV.foreach(FILE) do |row|
row.map! { |v| v.strip!; v == 'NULL' || v.blank? ? nil : v }
unless header
header = row.freeze
next
end
# create a Hash where the key is the column name, and the value is the field value
data = header.zip(row).to_hash
# ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment