Where to place private methods in Ruby?

前端 未结 10 1008
故里飘歌
故里飘歌 2021-01-30 00:50

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

10条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-30 01:02

    I don't like having to specify public or private for each method. Putting all private methods at the bottom lets me have a single instance of "private" per file. I guess it's a matter of taste.

提交回复
热议问题