Skip to content

Instantly share code, notes, and snippets.

@bil-bas
Created August 21, 2012 21:13
Show Gist options
  • Save bil-bas/3419440 to your computer and use it in GitHub Desktop.
Save bil-bas/3419440 to your computer and use it in GitHub Desktop.
require 'fastercsv' # Gem I'm assuming is beign used, but there are others.
hash = {} # So apeiros_ doesn't murder me
FasterCSV.foreach("path/to/file.csv") do |line|
hash[line[0].to_sym] = { :location => line[1], :device_type => line[3] }
end
# then you can reference with
hash[:frog][:location]
# and
hash[:frog][:device_type]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment