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



581
582
583
584
# File 'lib/sup/util.rb', line 581

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