diff options
Diffstat (limited to 'activesupport/lib/active_support/dependencies.rb')
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 0f59558bb5..9dc2c46880 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -224,6 +224,8 @@ module ActiveSupport #:nodoc: Dependencies.require_or_load(file_name) end + # :doc: + # 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>. @@ -242,6 +244,8 @@ module ActiveSupport #:nodoc: Dependencies.depend_on(file_name, message) end + # :nodoc: + def load_dependency(file) if Dependencies.load? && Dependencies.constant_watch_stack.watching? Dependencies.new_constants_in(Object) { yield } @@ -341,7 +345,7 @@ module ActiveSupport #:nodoc: end def require_or_load(file_name, const_path = nil) - file_name = $` if file_name =~ /\.rb\z/ + file_name = file_name.chomp(".rb") expanded = File.expand_path(file_name) return if loaded.include?(expanded) @@ -391,7 +395,7 @@ module ActiveSupport #:nodoc: # constant paths which would cause Dependencies to attempt to load this # file. def loadable_constants_for_path(path, bases = autoload_paths) - path = $` if path =~ /\.rb\z/ + path = path.chomp(".rb") expanded_path = File.expand_path(path) paths = [] |