mirror of https://github.com/rails/rails
Include as loaded regardless of success
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@281 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
fa1f5e062e
commit
7fcf07d632
|
@ -10,12 +10,16 @@ module Dependencies
|
|||
mattr_accessor :mechanism
|
||||
|
||||
def depend_on(file_name, swallow_load_errors = false)
|
||||
if !loaded.include?(file_name)
|
||||
loaded << file_name
|
||||
|
||||
begin
|
||||
loaded << require_or_load(file_name) if !loaded.include?(file_name)
|
||||
require_or_load(file_name)
|
||||
rescue LoadError
|
||||
raise unless swallow_load_errors
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def associate_with(file_name)
|
||||
depend_on(file_name, true)
|
||||
|
@ -38,7 +42,6 @@ module Dependencies
|
|||
private
|
||||
def require_or_load(file_name)
|
||||
mechanism == :load ? silence_warnings { load("#{file_name}.rb") } : require(file_name)
|
||||
return file_name
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue