Module: Rails

Defined in:
lib/rails.rb,
lib/rails/info.rb,
lib/rails/rack.rb,
lib/rails/paths.rb,
lib/rails/engine.rb,
lib/rails/plugin.rb,
lib/rails/railtie.rb,
lib/rails/version.rb,
lib/rails/generators.rb,
lib/rails/application.rb,
lib/rails/deprecation.rb,
lib/rails/rack/logger.rb,
lib/rails/configuration.rb,
lib/rails/initializable.rb,
lib/rails/rack/debugger.rb,
lib/rails/commands/server.rb,
lib/rails/generators/base.rb,
lib/rails/rack/log_tailer.rb,
lib/rails/commands/console.rb,
lib/rails/backtrace_cleaner.rb,
lib/rails/test_unit/railtie.rb,
lib/rails/commands/dbconsole.rb,
lib/rails/generators/actions.rb,
lib/rails/engine/configurable.rb,
lib/rails/script_rails_loader.rb,
lib/rails/application/finisher.rb,
lib/rails/application/railties.rb,
lib/rails/engine/configuration.rb,
lib/rails/generators/migration.rb,
lib/rails/generators/test_case.rb,
lib/rails/railtie/configurable.rb,
lib/rails/application/bootstrap.rb,
lib/rails/generators/named_base.rb,
lib/rails/railtie/configuration.rb,
lib/rails/generators/active_model.rb,
lib/rails/application/configurable.rb,
lib/rails/application/configuration.rb,
lib/rails/generators/resource_helpers.rb,
lib/rails/generators/generated_attribute.rb,
lib/rails/generators/rails/app/app_generator.rb,
lib/rails/generators/rails/model/model_generator.rb,
lib/rails/generators/rails/helper/helper_generator.rb,
lib/rails/generators/rails/plugin/plugin_generator.rb,
lib/rails/generators/rails/observer/observer_generator.rb,
lib/rails/generators/rails/resource/resource_generator.rb,
lib/rails/generators/rails/scaffold/scaffold_generator.rb,
lib/rails/generators/rails/generator/generator_generator.rb,
lib/rails/generators/rails/migration/migration_generator.rb,
lib/rails/generators/rails/controller/controller_generator.rb,
lib/rails/generators/rails/stylesheets/stylesheets_generator.rb,
lib/rails/generators/rails/integration_test/integration_test_generator.rb,
lib/rails/generators/rails/performance_test/performance_test_generator.rb,
lib/rails/generators/rails/session_migration/session_migration_generator.rb,
lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb

Defined Under Namespace

Modules: ActionMethods, BacktraceFilterForTestUnit, Configuration, Generators, Info, Initializable, Initializer, Paths, Rack, ScriptRailsLoader, VERSION Classes: AppBuilder, Application, BacktraceCleaner, Console, DBConsole, DeprecatedConstant, Engine, InfoController, Plugin, Railtie, Server, TestUnitRailtie

Class Method Summary collapse

Class Method Details

.applicationObject



34
35
36
# File 'lib/rails.rb', line 34

def application
  @@application ||= nil
end

.application=(application) ⇒ Object



38
39
40
# File 'lib/rails.rb', line 38

def application=(application)
  @@application = application
end

.backtrace_cleanerObject



67
68
69
70
71
72
73
# File 'lib/rails.rb', line 67

def backtrace_cleaner
  @@backtrace_cleaner ||= begin
    # Relies on Active Support, so we have to lazy load to postpone definition until AS has been loaded
    require 'rails/backtrace_cleaner'
    Rails::BacktraceCleaner.new
  end
end

.cacheObject



87
88
89
# File 'lib/rails.rb', line 87

def cache
  RAILS_CACHE
end

.configurationObject

The Configuration instance used to configure the Rails environment



43
44
45
# File 'lib/rails.rb', line 43

def configuration
  application.config
end

.envObject



79
80
81
# File 'lib/rails.rb', line 79

def env
  @_env ||= ActiveSupport::StringInquirer.new(ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development")
end

.env=(environment) ⇒ Object



83
84
85
# File 'lib/rails.rb', line 83

def env=(environment)
  @_env = ActiveSupport::StringInquirer.new(environment)
end

.initialize!Object



47
48
49
# File 'lib/rails.rb', line 47

def initialize!
  application.initialize!
end

.initialized=(initialized) ⇒ Object



55
56
57
# File 'lib/rails.rb', line 55

def initialized=(initialized)
  @@initialized ||= initialized
end

.initialized?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/rails.rb', line 51

def initialized?
  @@initialized || false
end

.loggerObject



59
60
61
# File 'lib/rails.rb', line 59

def logger
  @@logger ||= nil
end

.logger=(logger) ⇒ Object



63
64
65
# File 'lib/rails.rb', line 63

def logger=(logger)
  @@logger = logger
end

.public_pathObject



95
96
97
# File 'lib/rails.rb', line 95

def public_path
  application && application.paths.public.to_a.first
end

.public_path=(path) ⇒ Object



99
100
101
102
# File 'lib/rails.rb', line 99

def public_path=(path)
  ActiveSupport::Deprecation.warn "Setting Rails.public_path= is deprecated. " <<
    "Please set paths.public = in config/application.rb instead.", caller
end

.rootObject



75
76
77
# File 'lib/rails.rb', line 75

def root
  application && application.config.root
end

.versionObject



91
92
93
# File 'lib/rails.rb', line 91

def version
  VERSION::STRING
end