Created
September 23, 2016 14:32
-
-
Save rjollet/fc5c007e3ceec1cec4328a291553155f 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
require 'yaml' | |
require 'csv' | |
def hashs_to_array(hashs) | |
array = [] | |
hashs.each do |hash| | |
array << hash.keys if array == [] | |
array << hash.values | |
end | |
array | |
end | |
hashs = YAML.load(File.read(ARGV[0])) | |
array = hashs_to_array hashs | |
File.open(ARGV[1], 'w') do |file| | |
file.puts array.map(&:to_csv) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment