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

:nodoc:



7
8
9
# File 'lib/rails/initializable.rb', line 7

def self.included(base) # :nodoc:
  base.extend ClassMethods
end

Instance Method Details

#initializersObject



66
67
68
# File 'lib/rails/initializable.rb', line 66

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

#run_initializers(group = :default, *args) ⇒ Object



58
59
60
61
62
63
64
# File 'lib/rails/initializable.rb', line 58

def run_initializers(group = :default, *args)
  return if instance_variable_defined?(:@ran)
  initializers.tsort_each do |initializer|
    initializer.run(*args) if initializer.belongs_to?(group)
  end
  @ran = true
end