aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-06 12:32:34 +0100
committerJosé Valim <jose.valim@gmail.com>2011-12-06 21:09:44 +0100
commit885a599303585b796da7a0a1c3ccd0bc5c642134 (patch)
tree0cf767fa047b2ffefbfb2a7b5246915264625932 /activesupport
parent9dee5400845a5355b28868c475bc58c6cfb06216 (diff)
downloadrails-885a599303585b796da7a0a1c3ccd0bc5c642134.tar.gz
rails-885a599303585b796da7a0a1c3ccd0bc5c642134.tar.bz2
rails-885a599303585b796da7a0a1c3ccd0bc5c642134.zip
Just track "require" if we have something in the watching stack.
A patch has been provided earlier and we have asked for feedback: https://gist.github.com/1437939 Except one case, all other cases showed improvements in boot time.
Diffstat (limited to 'activesupport')
-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