aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/initializable.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/initializable.rb')
-rw-r--r--railties/lib/rails/initializable.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/railties/lib/rails/initializable.rb b/railties/lib/rails/initializable.rb
index 1a0b6d1e1a..5410e17153 100644
--- a/railties/lib/rails/initializable.rb
+++ b/railties/lib/rails/initializable.rb
@@ -1,4 +1,6 @@
-require 'tsort'
+# frozen_string_literal: true
+
+require "tsort"
module Rails
module Initializable
@@ -34,6 +36,10 @@ module Rails
return self if @context
Initializer.new(@name, context, @options, &block)
end
+
+ def context_class
+ @context.class
+ end
end
class Collection < Array
@@ -49,7 +55,7 @@ module Rails
end
end
- def run_initializers(group=:default, *args)
+ 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)