Created
January 13, 2016 17:57
-
-
Save rabidaudio/96ecad99f28dad3c9aef to your computer and use it in GitHub Desktop.
CSV rows to objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reqire 'csv' | |
csv = CSV.parse(File.read('input.csv')) | |
headers = csv.shift | |
objects = csv.map { |row| Hash[headers.zip(row)] } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment