Module: Ritsu::Utility::SingleInstance

Included in:
Project
Defined in:
lib/ritsu/utility/single_instance.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



18
19
20
# File 'lib/ritsu/utility/single_instance.rb', line 18

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

Instance Method Details

#initialize(*args, &block) ⇒ Object



22
23
24
25
# File 'lib/ritsu/utility/single_instance.rb', line 22

def initialize(*args, &block)
  initialize_instance(*args, &block)
  self.class.set_instance(self)
end

#initialize_instance(*args, &block) ⇒ Object



27
28
29
30
31
# File 'lib/ritsu/utility/single_instance.rb', line 27

def initialize_instance(*args, &block)
  if self.class.superclass.method_defined? :initialize_instance
    super
  end
end