Module: Rails::Initializable

Included in:
Application::Bootstrap, Application::Finisher, Railtie
Defined in:
lib/rails/initializable.rb

Defined Under Namespace

Modules: ClassMethods Classes: Collection, Initializer

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/rails/initializable.rb', line 5

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

Instance Method Details

#initializersObject



55
56
57
# File 'lib/rails/initializable.rb', line 55

def initializers
  @initializers ||= self.class.initializers_for(self)
end

#run_initializers(*args) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/rails/initializable.rb', line 47

def run_initializers(*args)
  return if instance_variable_defined?(:@ran)
  initializers.tsort.each do |initializer|
    initializer.run(*args)
  end
  @ran = true
end