diff options
Diffstat (limited to 'activesupport/lib/active_support/dependencies.rb')
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 9681af6dff..30911453bc 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -33,12 +33,21 @@ module Dependencies #:nodoc: def clear self.loaded = [ ] end - + def require_or_load(file_name) file_name = "#{file_name}.rb" unless ! load? || file_name[-3..-1] == '.rb' - load? ? load(file_name) : require(file_name) + if load? + begin + original_verbosity, $VERBOSE = $VERBOSE, true + load file_name + ensure + $VERBOSE = original_verbosity + end + else + require file_name + end end - + def remove_subclasses_for(*classes) Object.remove_subclasses_of(*classes) end |