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
-
.included(base) ⇒ Object
:nodoc:.
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
:nodoc:
8 9 10 |
# File 'railties/lib/rails/initializable.rb', line 8 def self.included(base) # :nodoc: base.extend ClassMethods end |
Instance Method Details
#initializers ⇒ Object
109 110 111 |
# File 'railties/lib/rails/initializable.rb', line 109 def initializers @initializers ||= self.class.initializers_for(self) end |
#run_initializers(group = :default, *args) ⇒ Object
101 102 103 104 105 106 107 |
# File 'railties/lib/rails/initializable.rb', line 101 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 |