るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.438秒)

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

検索結果

Singleton (20.0)

Singleton パターンを提供するモジュールです。

...Singleton パターンを提供するモジュールです。

Mix-in により singleton パターンを提供します。

Singleton
モジュールを include することにより、クラスは
高々ひとつのインスタンスしか持たないことが保証されます。

Singleton
を M...
...e 'singleton'

class
SomeSingletonClass
include Singleton
#....
end

a = SomeSingletonClass.instance
b = SomeSingletonClass.instance # a and b are same object
p [a,b] # => [#<SomeSingletonClass:0x0000562e6e18ddd0>, #<SomeSingletonClass:0x0000562e6e18ddd0>]
a = SomeSingletonClass.n...
...ew # => NoMethodError (private method `new' called for SomeSingletonClass:Class)...