[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
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く