DEV Community

Discussion on: Why do you love Ruby, actually? An ode.

Collapse
 
olivierjm profile image
Olivier JM Maniraho

I started working with ruby about a year ago when I joined a company that was using ruby on rails, I had no prior knowledge in ruby but it only took a few days to get acquainted with the syntax.
Since then I have found so many things in ruby that just amaze me and simplify my life on a daily basis.
It is also worth noting that writings tests in ruby is way easier than in most other languages and I am yet to find a lib in other languages that magically works like search_cop.

Collapse
 
sylwiavargas profile image
Sylwia Vargas

TESTS! I forgot about how fun and stress-free testing in Ruby is. Thank you. Maybe this is going to be next blog material.

Do you have any Ruby favorite tricks and tips? Any method(s) that deserve special appreciation?

Collapse
 
olivierjm profile image
Olivier JM Maniraho • Edited
  1. Accessing models and their methods in the rails console is one of my favourite
  2. Date methods are arguably the best, there is just no way Time.now.tomorrow, Time.now.yesterday, or using .first, .second(I remember I told so many people the first time I found this)
  3. There is just so many methods out of the box that are very useful

I took me a bit of time however to grasp the unless this do that or return this if that then another statement after this.
I still use rails for any new projects I create

Thread Thread
 
sylwiavargas profile image
Sylwia Vargas • Edited

DATES. That's another one that I forgot — and such an easy one to contrast with JS:
browser console showing inconsistencies of date logic in JS

It's interesting that you mention this syntax as baffling for you:

unless this do that or return this if that

For me this is the specific feature that felt like I'm playing with lego. When I later learned JS, I've developed a strong preference for refactoring if/else statements this way as well and literally everyone compliments me on this :D I wish all JS devs were trained in Ruby first so they'd write less of a spaghetti code.

Thread Thread
 
olivierjm profile image
Olivier JM Maniraho

It took me a while to grasp it but once I understood it I really loved it. Thanks for the article it looks interesting.