lib/active_support/dependencies.rb in activesupport-5.2.1.1 vs lib/active_support/dependencies.rb in activesupport-5.2.2.rc1

- old
+ new

@@ -95,10 +95,12 @@ # @watching is a stack of lists of constants being watched. For instance, # if parent.rb is autoloaded, the stack will look like [[Object]]. If # parent.rb then requires namespace/child.rb, the stack will look like # [[Object], [Namespace]]. + attr_reader :watching + def initialize @watching = [] @stack = Hash.new { |h, k| h[k] = [] } end @@ -246,10 +248,12 @@ # :nodoc: def load_dependency(file) if Dependencies.load? && Dependencies.constant_watch_stack.watching? - Dependencies.new_constants_in(Object) { yield } + descs = Dependencies.constant_watch_stack.watching.flatten.uniq + + Dependencies.new_constants_in(*descs) { yield } else yield end rescue Exception => exception # errors from loading file exception.blame_file! file if exception.respond_to? :blame_file!