Created
October 4, 2019 15:49
-
-
Save Heavyblade/d9cf6354772f03086ae9bf45cd9a751d 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 result_to_csv(name, result) | |
values = result.map { |x| x[:values] } | |
csv = [values.first.keys] | |
values.each { |x| csv << x.values } | |
csv_string = csv.map { |x| x.join(";") }.join("\n") | |
file = File.open(name, "w") | |
file.write(csv_string) | |
file.close | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment