Skip to content

Instantly share code, notes, and snippets.

@scottrobertson
Created February 7, 2016 21:42
Show Gist options
  • Save scottrobertson/16d76742580f82a6eb11 to your computer and use it in GitHub Desktop.
Save scottrobertson/16d76742580f82a6eb11 to your computer and use it in GitHub Desktop.
require 'csv'
letters = ['a', 'b', 'c']
numbers = [1,2,3]
numbers_2 = [4,5,6]
csv_string = CSV.generate do |csv|
letters.each_with_index do |letter, index|
csv << [
letter,
numbers[index],
numbers_2[index]
]
end
end
puts csv_string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment