aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2006-08-16 20:33:31 +0000
committerNicholas Seckar <nseckar@gmail.com>2006-08-16 20:33:31 +0000
commit38f598ec0b28919ff0d996bcb9ed923fbd99316f (patch)
treed0701ccbe7c68a3fdd8becb0c5c5946ad56ffa73 /activesupport/lib
parent50be89b609a5d37ed0ab2e3ddbbea8082989a772 (diff)
downloadrails-38f598ec0b28919ff0d996bcb9ed923fbd99316f.tar.gz
rails-38f598ec0b28919ff0d996bcb9ed923fbd99316f.tar.bz2
rails-38f598ec0b28919ff0d996bcb9ed923fbd99316f.zip
Update require_dependency to return true or false as require does.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4778 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/dependencies.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index b8a8a9b630..c0ee5ddfa8 100644
--- a/activesupport/lib/active_support/dependencies.rb
+++ b/activesupport/lib/active_support/dependencies.rb
@@ -75,9 +75,9 @@ module Dependencies #:nodoc:
load_args << const_path unless const_path.nil?
if !warnings_on_first_load or history.include?(expanded)
- load_file(*load_args)
+ result = load_file(*load_args)
else
- enable_warnings { load_file(*load_args) }
+ enable_warnings { result = load_file(*load_args) }
end
rescue
loaded.delete expanded
@@ -85,11 +85,12 @@ module Dependencies #:nodoc:
end
else
log "requiring #{file_name}"
- require file_name
+ result = require file_name
end
# Record history *after* loading so first load gets warnings.
history << expanded
+ return result
end
# Is the provided constant path defined?
@@ -157,12 +158,13 @@ module Dependencies #:nodoc:
const_paths = [const_paths].compact unless const_paths.is_a? Array
undefined_before = const_paths.reject(&method(:qualified_const_defined?))
- load path
+ result = load path
newly_defined_paths = const_paths.select(&method(:qualified_const_defined?))
autoloaded_constants.concat newly_defined_paths
autoloaded_constants.uniq!
log "loading #{path} defined #{newly_defined_paths * ', '}" unless newly_defined_paths.empty?
+ return result
end
# Return the constant path for the provided parent and constant name.