3 ms·
" (The attr_reader statement at the bottom " Defining variables at the bottom of the class, WTF?
by jacknews 2y ago
" (The attr_reader statement at the bottom "
Defining variables at the bottom of the class, WTF?
- eloisius 2y agoattr_reader defines reader methods that just return the ivar with the same name. They are just syntactic sugar, and sometimes it makes sense to put them after the private keyword, and private methods are idiomatically at the “bottom” of the class.
- rezonant 2y agoBy the way, this is perhaps my biggest problem with Ruby. It is far too easy to have a lot of private methods and to lose sight of the fact that you're in the private section.
- deleted 2y ago[deleted]