diff options
author | ta1kt0me <p.wadachi@gmail.com> | 2016-06-12 18:08:34 +0900 |
---|---|---|
committer | ta1kt0me <p.wadachi@gmail.com> | 2016-06-12 18:08:34 +0900 |
commit | 9442239b45142dfaae48a9dc2812efbf2575a7f4 (patch) | |
tree | d2675a1a72c51a0ded430be57a7dc9c03ff7eeda /railties/lib | |
parent | 116f7a18b2c58fb160978958c6c5f644a8da1dee (diff) | |
download | rails-9442239b45142dfaae48a9dc2812efbf2575a7f4.tar.gz rails-9442239b45142dfaae48a9dc2812efbf2575a7f4.tar.bz2 rails-9442239b45142dfaae48a9dc2812efbf2575a7f4.zip |
Initializer provides its context class name
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/initializable.rb | 6 | ||||
-rw-r--r-- | railties/lib/rails/tasks/initializers.rake | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/railties/lib/rails/initializable.rb b/railties/lib/rails/initializable.rb index 085fbf64b2..292379e3f3 100644 --- a/railties/lib/rails/initializable.rb +++ b/railties/lib/rails/initializable.rb @@ -9,8 +9,6 @@ module Rails class Initializer attr_reader :name, :block - delegate :railtie_name, to: :@context - def initialize(name, context, options, &block) options[:group] ||= :default @name, @context, @options, @block = name, context, options, block @@ -36,6 +34,10 @@ module Rails return self if @context Initializer.new(@name, context, @options, &block) end + + def context_class + @context.class + end end class Collection < Array diff --git a/railties/lib/rails/tasks/initializers.rake b/railties/lib/rails/tasks/initializers.rake index fd66b27bcd..6522f2ae5a 100644 --- a/railties/lib/rails/tasks/initializers.rake +++ b/railties/lib/rails/tasks/initializers.rake @@ -1,6 +1,6 @@ desc "Print out all defined initializers in the order they are invoked by Rails." task initializers: :environment do Rails.application.initializers.tsort_each do |initializer| - puts "#{initializer.railtie_name}.#{initializer.name}" + puts "#{initializer.context_class}.#{initializer.name}" end end |