module Rails
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/rails.rbs module Rails def env: () -> untyped def root: () -> untyped end
def self.gem_version
def self.gem_version Gem::Version.new VERSION::STRING end
def self.version
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 ||= begin # Relies on Active Support, so we have to lazy load to postpone definition until Active Support has been loaded require "rails/backtrace_cleaner" Rails::BacktraceCleaner.new end end
def configuration
def configuration application.config end
def env
Experimental RBS support (using type sampling data from the type_fusion
project).
def env: () -> untyped
This signature was generated using 1 sample from 1 application.
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)
Sets the Rails environment.
def env=(environment) @_env = ActiveSupport::EnvironmentInquirer.new(environment) end
def 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 application && application.executor.error_reporter end
def groups(*groups)
# => [: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
Experimental RBS support (using type sampling data from the type_fusion
project).
def root: () -> untyped
This signature was generated using 1 sample from 1 application.
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