aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/dependencies.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index 989c7205fa..43dd22654a 100644
--- a/activesupport/lib/active_support/dependencies.rb
+++ b/activesupport/lib/active_support/dependencies.rb
@@ -87,6 +87,10 @@ module ActiveSupport #:nodoc:
@stack.each(&block)
end
+ def watching?
+ !@watching.empty?
+ end
+
# return a list of new constants found since the last call to watch_namespaces
def new_constants
constants = []
@@ -226,7 +230,7 @@ module ActiveSupport #:nodoc:
end
def load_dependency(file)
- if Dependencies.load?
+ if Dependencies.load? && ActiveSupport::Dependencies.constant_watch_stack.watching?
Dependencies.new_constants_in(Object) { yield }
else
yield