# Method Shorthand in Ruby

*Published on January 19, 2023*

---


While reading the&nbsp;[docs](https://ruby-doc.org/3.2.0/syntax/methods_rdoc.html), I learned that Ruby (3.0 and up) provides a shorthand syntax for one-line methods, similar to computed properties in C#.

![ruby-method-shorthand.png](https://writesoftwarewell.com/media/xitoc8lmey03yincnmmkfebfp88b.png "Ruby Method Shorthand")

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&nbsp;`=`&nbsp;in the name. For me, the saved keystrokes aren't worth the mental overhead.

I also shared the above code on&nbsp;[Reddit](https://www.reddit.com/r/rails/comments/10eu1gg/shorthand_for_oneline_methods_in_ruby_30_what_do/?utm_source=share&utm_medium=web2x&context=3)&nbsp;and&nbsp;[LinkedIn](https://www.linkedin.com/feed/update/urn:li:activity:7021215838099685376?utm_source=share&utm_medium=member_desktop), and there was a lot of interesting discussion with nuanced comments.

**What do you think?**&nbsp;Too much syntactic sugar, or a nice way to express short properties? Let me know in the comments.

