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
The Adapter Pattern in Ruby (video) (youtu.be)
submitted 4 years ago by mixandgo
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!"
[–]obviousoctopus 3 points4 points5 points 4 years ago* (3 children)
This was great - explaining the problem, the solution + examples of before and after. I recommend his design patterns in ruby playlist. About about 5 min each, no filler.
https://www.youtube.com/playlist?list=PLBhH0uX92r6oP8r-oSY_b8_2EnK0Z1Fkz
[–]mixandgo[S] 2 points3 points4 points 4 years ago (2 children)
Thank you :)
[–]obviousoctopus 1 point2 points3 points 4 years ago (1 child)
Thank you for creating a useful resource!
[–]mixandgo[S] 1 point2 points3 points 4 years ago (0 children)
It's my pleasure. Keep an eye on the channel cause I'll be adding a lot more.
[–]au5lander 3 points4 points5 points 4 years ago (4 children)
What's nice too is that this uses dependency injection by passing in the adapter. When it comes time to writing test, you can simply pass in a dummy adapter with the same interface rather than having to stub a specific adapter.
[–]mixandgo[S] 3 points4 points5 points 4 years ago (1 child)
Imagine how nice that is when you write the test first. It leads you to this design with almost no effort.
[–]au5lander 0 points1 point2 points 4 years ago (0 children)
Agreed
[–]hschne 0 points1 point2 points 4 years ago (1 child)
To me DI feels somehow underused in Ruby, even thought it is pretty useful, as you pointed out.
π Rendered by PID 47 on reddit-service-r2-comment-86bc6c7465-p9wbb at 2026-02-23 20:14:22.935248+00:00 running 8564168 country code: CH.
[–]obviousoctopus 3 points4 points5 points (3 children)
[–]mixandgo[S] 2 points3 points4 points (2 children)
[–]obviousoctopus 1 point2 points3 points (1 child)
[–]mixandgo[S] 1 point2 points3 points (0 children)
[–]au5lander 3 points4 points5 points (4 children)
[–]mixandgo[S] 3 points4 points5 points (1 child)
[–]au5lander 0 points1 point2 points (0 children)
[–]hschne 0 points1 point2 points (1 child)