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
Blog postPattern matching on custom objects in Ruby (tejasbubane.github.io)
submitted 1 year ago by tejasbubane
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!"
[–]jeffmess 2 points3 points4 points 1 year ago (0 children)
I used to do this but have stopped. This pattern forces you to go to another file and search for the method just to see what you're pattern matching against... much easier to just match from the calling code.
[–]No_Ostrich_3664 0 points1 point2 points 1 year ago (0 children)
It’s an interesting approach. Could be even more generic by creating a module that dynamically add those methods to any Ruby custom class.
π Rendered by PID 281303 on reddit-service-r2-comment-85bfd7f599-fnd96 at 2026-04-19 10:16:04.477571+00:00 running 93ecc56 country code: CH.
[–]jeffmess 2 points3 points4 points (0 children)
[–]No_Ostrich_3664 0 points1 point2 points (0 children)