123456789_123456789_123456789_123456789_123456789_

Module: Singleton::SingletonClassMethods

Do not use. This module is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/singleton.rb

Instance Method Summary

Instance Method Details

#_load(str)

By default calls instance(). Override to retain singleton state.

[ GitHub ]

  
# File 'lib/singleton.rb', line 122

def _load(str)
  instance
end

#clone

[ GitHub ]

  
# File 'lib/singleton.rb', line 117

def clone # :nodoc:
  Singleton.__init__(super)
end

#inherited(sub_klass) (private)

[ GitHub ]

  
# File 'lib/singleton.rb', line 132

def inherited(sub_klass)
  super
  Singleton.__init__(sub_klass)
end

#instance

[ GitHub ]

  
# File 'lib/singleton.rb', line 126

def instance # :nodoc:
  @singleton__instance__ || @singleton__mutex__.synchronize { @singleton__instance__ ||= new }
end

#set_instance(val) (private)

[ GitHub ]

  
# File 'lib/singleton.rb', line 137

def set_instance(val)
  @singleton__instance__ = val
end

#set_mutex(val) (private)

[ GitHub ]

  
# File 'lib/singleton.rb', line 141

def set_mutex(val)
  @singleton__mutex__ = val
end