Module: Singleton

Overview

simple singleton module. far less complete and insane than the ruby standard library one, but it automatically forwards methods calls and allows for constructors that take arguments.

classes that inherit this can define initialize. however, you cannot call .new on the class. To get the instance of the class, call .instance; to create the instance, call init.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



617
618
619
620
# File 'lib/sup/util.rb', line 617

def self.included klass
  klass.private_class_method :allocate, :new
  klass.extend ClassMethods
end