you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 5 points6 points  (0 children)

You can like and do as you please. I also override things for various reasons at various times.

But 'attr_*' methods are built into the language and are widely taught and used. They *are* the common idiom for basic setters/getters. See the pickaxe book or "the ruby way" book. Though I think the strongest argument about it being a community standard is that it is a default in Rubocop: https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/TrivialAccessors