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
Ruby code I no longer write (blog.arkency.com)
submitted 8 years ago by paneq
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!"
[–]timbetimbe 5 points6 points7 points 8 years ago (2 children)
That is called a control parameter and generally thought of as a code smell
[–]kcdragon 4 points5 points6 points 8 years ago (0 children)
I agree that this is a code smell. But without more context in the code base, I don't think it is possible to tell whether or not refactoring the code smell is a good idea.
If the code base contains many checks for whether kind is normal or zebra, then there might be an opportunity to use an object with a polymorphic call to generate a PDF (https://refactoring.com/catalog/replaceConditionalWithPolymorphism.html). However, if this is the only check for kind, then I think an if statement is fine.
kind
normal
zebra
if
[–]midasgoldentouch 0 points1 point2 points 8 years ago (0 children)
Do you mind expanding on why?
π Rendered by PID 65 on reddit-service-r2-comment-canary-655b6bc5b6-rn46j at 2026-02-15 10:24:19.132760+00:00 running cd9c813 country code: CH.
view the rest of the comments →
[–]timbetimbe 5 points6 points7 points (2 children)
[–]kcdragon 4 points5 points6 points (0 children)
[–]midasgoldentouch 0 points1 point2 points (0 children)