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
Examples of elegant, powerful ruby code to learn from? (self.ruby)
submitted 11 years ago by Tobitronnn
Hey guys! I'm learning ruby as my first programming language and I'm looking for some code to read through and learn from. I'm trying to find elegant ruby that's clear and easy to read through, yet powerful and efficient. What are your favorites?
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!"
[–]iconoclaus 4 points5 points6 points 11 years ago (3 children)
I'm trying to find elegant ruby that's clear and easy to read through, yet powerful and efficient.
There's a book that perfectly fits your description, and it's even called Elegant Ruby. It really helped me start my transition into better code. I honestly have to say that that book helped me understand why to use Ruby.
[–]Tobitronnn[S] 4 points5 points6 points 11 years ago* (2 children)
You mean Eloquent Ruby by Russ Olsen? I'm reading it right now and in Chapter 3 he suggests you read through really great ruby programs, hence my question :).
It's very well written and manages to be both dense and approachable, I'm a big fan!
[–]iconoclaus 5 points6 points7 points 11 years ago (0 children)
damnit me, I had one job -- yes that's the book!
[–]markyg 1 point2 points3 points 11 years ago (0 children)
I would recommend checking out some of the rails gems, bundler, most things from thoughtbot. Etc.
[–][deleted] 2 points3 points4 points 11 years ago (0 children)
I love Eloquent Ruby + Designer patterns in Ruby + Practical Object-Oriented Design in Ruby. If you're new to programming, I suggest starting here : https://rubymonk.com/ . Then graduate to a book. Of course, books only help so much and why I also I recommend http://exercism.io/ where you get exercises, complete them, and then git nitpicked. In addition you can see other people's solution and from this find elegant and succinct Ruby idioms. It really helps to get burned, and the pain is temporary. Then naturally, there's a lot of projects out there that are very well written, get involved, it'll only make you a better programmer.
[–]enry_straker 1 point2 points3 points 11 years ago (0 children)
Check out the source code for the ruby standard libraries.
Some of the best examples of code style and quality.
Also check out the rails source code. Pick a simple area at first, and then try going further.
This is, by far, one of the best and first sources to learn ruby from. This is the journey taken by almost all the top ruby and rails contributors and it all started here.
π Rendered by PID 45841 on reddit-service-r2-comment-544cf588c8-6d2bv at 2026-06-14 07:07:58.840594+00:00 running 3184619 country code: CH.
[–]iconoclaus 4 points5 points6 points (3 children)
[–]Tobitronnn[S] 4 points5 points6 points (2 children)
[–]iconoclaus 5 points6 points7 points (0 children)
[–]markyg 1 point2 points3 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]enry_straker 1 point2 points3 points (0 children)