module Rails

def self.deprecator # :nodoc:

:nodoc:
def self.deprecator # :nodoc:
  @deprecator ||= ActiveSupport::Deprecation.new
end

def self.gem_version

Returns the currently loaded version of \Rails as a +Gem::Version+.
def self.gem_version
  Gem::Version.new VERSION::STRING
end

def self.version

Returns the currently loaded version of \Rails as a string.
def self.version
  VERSION::STRING
end

def application

def application
  @application ||= (app_class.instance if app_class)
end

def autoloaders

def autoloaders
  application.autoloaders
end

def backtrace_cleaner

def backtrace_cleaner
  @backtrace_cleaner ||= Rails::BacktraceCleaner.new
end

def configuration

The Configuration instance used to configure the \Rails environment
def configuration
  application.config
end

def env

Rails.env.local? # => true true for "development" and "test", false for anything else
Rails.env.production? # => false
Rails.env.development? # => true
Rails.env # => "development"

Returns the current \Rails environment.
def env
  @_env ||= ActiveSupport::EnvironmentInquirer.new(ENV["RAILS_ENV"].presence || ENV["RACK_ENV"].presence || "development")
end

def env=(environment)

Rails.env = "staging" # => "staging"

Sets the \Rails environment.
def env=(environment)
  @_env = ActiveSupport::EnvironmentInquirer.new(environment)
end

def error

Rails.error.report(error)
end
# ...
Rails.error.handle(IOError) do

otherwise it returns +nil+ if there is no project.
Returns the ActiveSupport::ErrorReporter of the current \Rails project,
def error
  ActiveSupport.error_reporter
end

def groups(*groups)

# => [:default, "production"] for Rails.env == "production"
# => [:default, "development", :assets] for Rails.env == "development"
Rails.groups assets: [:development, :test]

* The optional envs given as argument and the hash with group dependencies;
* The environment variable RAILS_GROUPS;
* The \Rails environment;

Returns all \Rails groups for loading based on:
def groups(*groups)
  hash = groups.extract_options!
  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.compact!
  groups.uniq!
  groups
end

def public_path

# => #
Rails.public_path

\Rails project, otherwise it returns +nil+ if there is no project:
Returns a Pathname object of the public folder of the current
def public_path
  application && Pathname.new(application.paths["public"].first)
end

def root

# => #
Rails.root

otherwise it returns +nil+ if there is no project:
Returns a Pathname object of the current \Rails project,
def root
  application && application.config.root
end