Skip to content

Commit

Permalink
Merge pull request #10915 from gsamokovarov/railties-autoloads
Browse files Browse the repository at this point in the history
Refactor of ::Rails module
  • Loading branch information
guilleiguaran committed Jun 12, 2013
2 parents 5dedd2c + 50be56d commit 9fc574f
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions railties/lib/rails.rb
Expand Up @@ -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'
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9fc574f

Please sign in to comment.