Singleton
singletonライブラリを使えばいい。
require 'singleton' class Hoge include Singleton end Hoge.instance # => #<Hoge:0xb7b2ccc8> Hoge.instance.object_id # => -606509468 Hoge.instance.object_id # => -606509468
singletonライブラリを使えばいい。
require 'singleton' class Hoge include Singleton end Hoge.instance # => #<Hoge:0xb7b2ccc8> Hoge.instance.object_id # => -606509468 Hoge.instance.object_id # => -606509468