While reading the docs, I learned that Ruby (3.0 and up) provides a shorthand syntax for one-line methods, similar to computed properties in C#.
Personally, I don't plan to use them in my code, except in tests. I prefer the standard syntax. The shorthand also looks confusing with the setter methods that already have a =
in the name. For me, the saved keystrokes aren't worth the mental overhead.
I also shared the above code on Reddit and LinkedIn, and there was a lot of interesting discussion with nuanced comments.
What do you think? Too much syntactic sugar, or a nice way to express short properties? Let me know in the comments.