diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-06-12 07:18:50 -0700 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-06-12 07:18:50 -0700 |
commit | 9fc574fdea359963679e2385e04c23ff007f25e9 (patch) | |
tree | 03255ddc9401b72458d749da34e529338f4dffd8 /railties/lib/rails.rb | |
parent | 5dedd2cd21e659ced0720054cbadddcf48c27ba9 (diff) | |
parent | 50be56dcdeb94679106ba02168a0fc1f87265d5a (diff) | |
download | rails-9fc574fdea359963679e2385e04c23ff007f25e9.tar.gz rails-9fc574fdea359963679e2385e04c23ff007f25e9.tar.bz2 rails-9fc574fdea359963679e2385e04c23ff007f25e9.zip |
Merge pull request #10915 from gsamokovarov/railties-autoloads
Refactor of ::Rails module
Diffstat (limited to 'railties/lib/rails.rb')
-rw-r--r-- | railties/lib/rails.rb | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/railties/lib/rails.rb b/railties/lib/rails.rb index bb98bbe5bf..3a3c11d8b3 100644 --- a/railties/lib/rails.rb +++ b/railties/lib/rails.rb @@ -3,7 +3,9 @@ require 'rails/ruby_version_check' require 'pathname' require 'active_support' +require 'active_support/dependencies/autoload' require 'active_support/core_ext/kernel/reporting' +require 'active_support/core_ext/module/delegation' require 'active_support/core_ext/array/extract_options' require 'rails/application' @@ -20,26 +22,22 @@ silence_warnings do end module Rails - autoload :Info, 'rails/info' - autoload :InfoController, 'rails/info_controller' - autoload :WelcomeController, 'rails/welcome_controller' + extend ActiveSupport::Autoload + + autoload :Info + autoload :InfoController + autoload :WelcomeController class << self attr_accessor :application, :cache, :logger + delegate :initialize!, :initialized?, to: :application + # The Configuration instance used to configure the Rails environment def configuration application.config end - def initialize! - application.initialize! - end - - def initialized? - application.initialized? - end - def backtrace_cleaner @backtrace_cleaner ||= begin # Relies on Active Support, so we have to lazy load to postpone definition until AS has been loaded @@ -76,7 +74,7 @@ module Rails env = Rails.env groups.unshift(:default, env) groups.concat ENV["RAILS_GROUPS"].to_s.split(",") - groups.concat hash.map { |k,v| k if v.map(&:to_s).include?(env) } + groups.concat hash.map { |k, v| k if v.map(&:to_s).include?(env) } groups.compact! groups.uniq! groups |