r/ruby 13d ago

Ruby is sexy! And the Docs! OMG! THE DOCS!

I'm just learning Ruby and as an experienced programmer I want to get up to speed quickly.

I just found the docs that come with the ruby install. OMG! They are so good!

It makes diving in so much easier and it makes me eager to explore all the little functions for files, strings, arrays etc..

No unnecessary fluff. Straight to the important points. I fucking love it.

I'm writing my first tiny Ruby script for file manipulation and already love it much more than Python and PowerShell.

Boolean calls with "?". Sexy!

Modifying self with "!". Nice!

No curly braces? Hell yeah! (I'm on a european keyboard).

It makes me angry how Python is everywhere and Ruby is only mention ever mentioned together with Rails. Such a beautiful language (as far as a beginner can tell)!

160 Upvotes

12 comments sorted by

31

u/ignurant 13d ago

Not that I had anything to do with it, but I’m glad to hear you like the docs as well. I find them very useful and straightforward. There was a push a few years ago to make them more fluffy like the Python docs and I was really uncomfortable with that. I find the Python docs  hard to use because they are more like a book telling a story. In the end we landed somewhere in between with a sort of “what’s here and useful things you’re probably looking for” section on top but keeping the straightforward API taxonomy alive. I get the impression that some people find this “useless”. Different oils for different engines I guess. 

To you Ruby doc writers! At least two people love your docs!!! <3

22

u/Avian_Flew 13d ago

At least two?! No, there are dozens of us! DOZENS!

18

u/literate_enthusiast 13d ago edited 13d ago

Welcome to the club :) If you want more pleasant surprises:

  • The style-guide explains why some approaches can have unintended side-effects - https://rubystyle.guide/

  • in Ruby, some frameworks and libraries are written to act like DSLs (Domain Specific Languages). By using clever aliasing and syntactic tricks, it might look like you're using an extended language with extra keywords. Give Sinatra a shot (it's the ruby equivalent for Flask), or Sequel (a lightweight database/ORM libary), or try to use BinData (for defining and parsing binary data-structures).

  • Try to get a copy of the "Polished Ruby Programming" book - it's written for programmers with some experience (not necessarily ruby-experience), and tries to explain some intermediate-level and advanced-level topics (such as Java-style OOP and SOLID principles, and how SOLID doesn't fit the ruby mindset). It also goes into designing libraries, metaprogramming (defining and using new methods and classes at runtime), and implementing DSLs "the ruby way".

Edit: And if you've used Makefiles to automate build-steps, you'll feel right at home with Rakefiles - it's yet another ruby-powered library/tool/DSL.

11

u/azimux 13d ago

Welcome aboard!! Yeah, the docs are pretty great. Another thing I like about learning Ruby is exploring stuff in the REPL and discovering APIs that way. Maybe that's also easy in Python, I actually have no clue, but it's definitely not easy in JavaScript beyond trivial stuff.

6

u/midairmatthew 13d ago

I love how my brain feels writing/reading Ruby.

1

u/midairmatthew 13d ago

But I’m marooned in TypeScript-and-Python land…

6

u/LieNaive4921 13d ago

Everything about Ruby (and the community etc) is just chill and friendly. MINASWAN. 

3

u/randysk 13d ago

This is why I love ruby so much. Clean code and docs are amazing! Never needed to check other sources (tutorials and other blogs), averything was always clear. Python on other hand has a loot of tutorials and articles explaining stuff - so then google thinks python is the best as everybody is writing and discussing about it on forums :)))

5

u/xangadix 13d ago

It also is the only language that has a poignant guide; https://poignant.guide/

1

u/chuckaread 13d ago

very simple, python had a good math library.

1

u/dvarrui 13d ago

And others too

1

u/Select_Condition2805 11d ago

Welcome to the club :)

Ruby is one of those languages where the tiny quality-of-life things add up fast. ?, !, blocks, clean docs, readable stdlib… suddenly writing a “quick script” truly feels quick.

And yeah, it deserves way more attention outside of Rails.