Most of the blogs or tutorials or books have private methods at the bottom of any class/module. Is this the best practice?
I find having private methods as and when nece
There's also the option to prepend private
to the method definition since Ruby 2.1.
class Example
def xmethod
end
private def ymethod
end
private def zmethod
end
end
Looking at the definition, you instantly know if a method is private, no matter where in the file it's defined. It's a bit more typing (if you don't autocomplete) and not all your def
s will be nicely aligned.