Module: Orbit::Singleton

Included in:
Application, Config, Interceptors::List, Router
Defined in:
lib/orbit/singleton.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
# File 'lib/orbit/singleton.rb', line 3

def self.included(base)
    base.extend(ClassMethods)
end

Instance Method Details

#instantiateObject

Raises:

  • (ArgumentError)


7
8
9
10
11
# File 'lib/orbit/singleton.rb', line 7

def instantiate
  raise ArgumentError.new("Cannot instantiate a Singleton twice") if self.class.instantiated?

  self.class.instance = self
end