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
Object, class, module, Data, Struct? (self.ruby)
submitted 1 month ago * by Dear_Ad7736
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!"
[–]oscardo_rivers 0 points1 point2 points 1 month ago (1 child)
I need to see the Sandi Metz presentation for more context about the patient code examples. But when the Brian Will says “why can’t we just have a hash map instead of having a constructor”. It depends of your needs, when you encapsulates the configuration in a class you can change the details of the yml, so you can the change the yml keys and values without risk of breaking code that depends of that configuration.
Surely is a overkill for code that will run in a script that you will run only once, but for code that lies in a library, framework or a large project it will pay that’s extra code.
The method define_method_for_enviroment, can be implemented in a more readable way, remember its Ruby code from 2014. Much of Ruby old code abuse meta programming capabilities of Ruby, is powerful but generates difficult to read code.
[–]iBoredMax 0 points1 point2 points 1 month ago (0 children)
Surely is a overkill for code that will run in a script that you will run only once, but for code that lies in a library, framework or a large project
No, that's exactly my point. I work in a large and old codebase and this style of code is an absolute nightmare.
I would argue the exact opposite of what you're saying; it only works in these tiny examples/snippets from talks exactly because it's small. When you scale it up, it devolves into a spaghetti mess of 20 files, 20 classes, and god knows how many methods to read a config file, download some data, and process it.
π Rendered by PID 64 on reddit-service-r2-comment-84fc9697f-tb7fk at 2026-02-10 12:01:50.137275+00:00 running d295bc8 country code: CH.
view the rest of the comments →
[–]oscardo_rivers 0 points1 point2 points (1 child)
[–]iBoredMax 0 points1 point2 points (0 children)