Module: Singleton::SingletonClassProperties

Included in:
RactorLocalSingleton, Singleton
Defined in:
lib/singleton.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(c) ⇒ Object



157
158
159
160
# File 'lib/singleton.rb', line 157

def self.extended(c)
  # extending an object with Singleton is a bad idea
  c.singleton_class.send(:undef_method, :extend_object)
end

.included(c) ⇒ Object



152
153
154
155
# File 'lib/singleton.rb', line 152

def self.included(c)
  # extending an object with Singleton is a bad idea
  c.undef_method :extend_object
end

Instance Method Details

#__init__(klass) ⇒ Object

:nodoc:



162
163
164
165
166
167
168
# File 'lib/singleton.rb', line 162

def __init__(klass) # :nodoc:
  klass.instance_eval {
    set_instance(nil)
    set_mutex(Thread::Mutex.new)
  }
  klass
end