module Singleton

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.

Public Class Methods

included(klass) click to toggle source
# File lib/sup/util.rb, line 567
def self.included klass
  klass.private_class_method :allocate, :new
  klass.extend ClassMethods
end