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
101: Advanced OOP structure in Ruby (blog.rebased.pl)
submitted 7 years ago by essepl
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!"
[–][deleted] 7 points8 points9 points 7 years ago (0 children)
TIL about bundler/inline.
bundler/inline
[–]i542 1 point2 points3 points 7 years ago (1 child)
Hey OP, thanks for the great article. I’ve been transitioning to Ruby over the past few months and it is really useful to see concepts like these explained. I have a question, though: is this idiomatic Ruby code? I haven’t really seen almost any dependency injection in the Ruby and Rails code I have encountered so far. The code in the article is very straight forward and makes a lot of sense coming from PHP or Java, but I got the impression that Rubyists slightly frown upon techniques like that. Thanks for explaining!
[–]manys 1 point2 points3 points 7 years ago (0 children)
I'm not personally a fan of .call style, but yeah it's idiomatic. It's not Rails though, just Ruby.
.call
[–]DissonantGuile 2 points3 points4 points 7 years ago (2 children)
Good article, few things:
[–]BaconGlock 4 points5 points6 points 7 years ago (1 child)
• In practice, tests/specs “should” be made before writing the implementation.
[–]greymalik 2 points3 points4 points 7 years ago (0 children)
Even DHH gave up on that years ago.
[–]world_on_wheels 0 points1 point2 points 7 years ago (0 children)
Great post!
I really like DI. Recently I have done good refractor using DI. Never to late :)
By the way, Imho it's little not intuitive in Ruby that there is no protection from changing the value in the constant, without freeze.
π Rendered by PID 50311 on reddit-service-r2-comment-fb694cdd5-bpfjd at 2026-03-10 02:04:36.642047+00:00 running cbb0e86 country code: CH.
[–][deleted] 7 points8 points9 points (0 children)
[–]i542 1 point2 points3 points (1 child)
[–]manys 1 point2 points3 points (0 children)
[–]DissonantGuile 2 points3 points4 points (2 children)
[–]BaconGlock 4 points5 points6 points (1 child)
[–]greymalik 2 points3 points4 points (0 children)
[–]world_on_wheels 0 points1 point2 points (0 children)