Skip to content

Instantly share code, notes, and snippets.

@ioquatix ioquatix/rows.rb
Created Jun 21, 2019

Embed
What would you like to do?
#!/usr/bin/env ruby
require 'csv'
require 'logger'
logger = Logger.new($stdout)
CSV do |csv|
5.times do
logger.info "Generating row..."
csv << ['1', '2', '3']
end
end
@ioquatix

This comment has been minimized.

Copy link
Owner Author

ioquatix commented Jun 21, 2019

If you run this:

rows.rb > output.csv

output.csv contains the following:

I, [2019-06-21T16:54:42.813759 #79664]  INFO -- : Generating row...
1,2,3
I, [2019-06-21T16:54:42.813883 #79664]  INFO -- : Generating row...
1,2,3
I, [2019-06-21T16:54:42.813902 #79664]  INFO -- : Generating row...
1,2,3
I, [2019-06-21T16:54:42.813915 #79664]  INFO -- : Generating row...
1,2,3
I, [2019-06-21T16:54:42.813927 #79664]  INFO -- : Generating row...
1,2,3

Is that what you wanted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.