Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #10915 from gsamokovarov/railties-autoloads

Refactor of ::Rails module
  • Loading branch information...
commit 9fc574fdea359963679e2385e04c23ff007f25e9 2 parents 5dedd2c + 50be56d
Guillermo Iguaran guilleiguaran authored
Showing with 10 additions and 12 deletions.
  1. +10 −12 railties/lib/rails.rb
22 railties/lib/rails.rb
View
@@ -3,7 +3,9 @@
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 @@
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 @@ def groups(*groups)
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
Please sign in to comment.
Something went wrong with that request. Please try again.