クラスメソッドのみを利用するクラスは代わりにこう書く。 あとはincludeされない、privateがあるなど、普通のオブジェクトのように使えるため。
include
private
before:
module Single def self.public_method # ... end end
after:
class << Single = Object.new def public_method private_method end private def private_method puts 'called' end end Single.public_method #=> called
There was an error while loading. Please reload this page.
_sidebar