るりまサーチ (Ruby 2.3.0)

最速Rubyリファレンスマニュアル検索!
1件ヒット [1-1件を表示] (0.012秒)
トップページ > バージョン:2.3.0[x] > クエリ:Method[x] > ライブラリ:singleton[x]

別のキーワード

  1. irb/input-method new
  2. irb/input-method gets
  3. _builtin define_method
  4. irb/input-method encoding
  5. irb/input-method readable_atfer_eof?

検索結果

Singleton (25.0)

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

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

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

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

Singleton
を M...
...ire '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...
....new # => NoMethodError (private method `new' called for SomeSingletonClass:Class)...