Created
May 28, 2013 10:59
-
-
Save etagwerker/5661973 to your computer and use it in GitHub Desktop.
Simple script to turn a CSV into YAML
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
require 'csv' | |
require 'yaml' | |
array = [] | |
i = 0 | |
CSV.foreach 'mentions.csv' do |l| | |
hash = {} | |
hash['url'] = l[2] | |
hash['date'] = l[1] | |
hash["mention_#{i}"] = '' | |
i += 1 | |
array << hash | |
end | |
puts array.to_yaml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment