Created
December 7, 2015 22:07
-
-
Save anonymous/b32533f1e6f67d78e8bc to your computer and use it in GitHub Desktop.
This file contains 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
def csv_to_hash(csv) | |
# Takes anything #read (which returns [[]]) or #to_a, like CSV | |
header, *lines = csv.read | |
rescue NoMethodError | |
header, *lines = csv.to_a | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment