aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2013-10-01 10:10:53 +0200
committerXavier Noria <fxn@hashref.com>2013-10-01 10:10:53 +0200
commit7dfbe58c70ec6acc9cee842fc8f18ec1ac57b66d (patch)
tree7ae59432f2a20c31c1a99781950b68299660b60e
parent276956d07ce5d893dbea81a14c400eaa1e6f3836 (diff)
downloadrails-7dfbe58c70ec6acc9cee842fc8f18ec1ac57b66d.tar.gz
rails-7dfbe58c70ec6acc9cee842fc8f18ec1ac57b66d.tar.bz2
rails-7dfbe58c70ec6acc9cee842fc8f18ec1ac57b66d.zip
revises the docs of require_dependency [ci skip]
-rw-r--r--activesupport/lib/active_support/dependencies.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index 6ca5d76fbb..df13fef0a4 100644
--- a/activesupport/lib/active_support/dependencies.rb
+++ b/activesupport/lib/active_support/dependencies.rb
@@ -198,7 +198,15 @@ module ActiveSupport #:nodoc:
Dependencies.require_or_load(file_name)
end
- # Files required this way can be reloaded in development mode
+ # Interprets a file using <tt>mechanism</tt> and marks its defined
+ # constants as autoloaded. <tt>file_name</tt> can be either a string or
+ # respond to <tt>to_path</tt>.
+ #
+ # Use this method in code that absolutely needs a certain constant to be
+ # defined at that point. A typical use case is to make constant name
+ # resolution deterministic for constants with the same relative name in
+ # different namespaces whose evaluation would depend on load order
+ # otherwise.
def require_dependency(file_name, message = "No such file to load -- %s")
file_name = file_name.to_path if file_name.respond_to?(:to_path)
unless file_name.is_a?(String)