Module: Rails::Initializable

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

Defined Under Namespace

Modules: ClassMethods Classes: Collection, Initializer

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) included(base)

:nodoc:



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

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

Instance Method Details

- (Object) initializers



60
61
62
# File 'railties/lib/rails/initializable.rb', line 60

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

- (Object) run_initializers(group = :default, *args)



52
53
54
55
56
57
58
# File 'railties/lib/rails/initializable.rb', line 52

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