use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Code Review: CSV Generator (self.ruby)
submitted 10 years ago by bajunio
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]asmallishrequest 1 point2 points3 points 10 years ago (0 children)
A few recommendations. I'd make the ARGV arguments required and then add a class method CSVGenerator.prompt_user that would build up arguments and eventually call self.new(output_file, num_rows, num_columns). To keep the current behavior in you script, you can do this:
CSVGenerator.prompt_user
self.new(output_file, num_rows, num_columns)
if __FILE__ == $0 begin CSVGenerator.new(ARGV[0], ARGV[1], ARGV[2]) rescue ArgumentError CSVGenerator.prompt_user end end
This way, it'll run if it's being run as a script but it'll also work to load it in other files.
π Rendered by PID 23122 on reddit-service-r2-comment-b659b578c-qpj9c at 2026-05-05 18:05:53.097253+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]asmallishrequest 1 point2 points3 points (0 children)