[edit] 要約 Singleton パターンを提供するモジュールです。 Mix-in により singleton パターンを提供します。 Singleton モジュールを include することにより、クラスは高々ひとつのインスタンスしか持たないことが保証されます。 Singleton を Mix-in したクラスのクラスメソッド instance はその唯一のインスタンスを返します。 new は private メソッドに移され、外部から呼び出そうとするとエラーになります。 サンプルコード require 'singleton' class SomeSingletonClass include Singleton #.... end a = SomeSingletonClass.instance b = SomeSingletonClass.instance # a and b a