lib/nanoc/base/compilation/dependency_tracker.rb in nanoc-3.3.6 vs lib/nanoc/base/compilation/dependency_tracker.rb in nanoc-3.3.7
- old
+ new
@@ -35,12 +35,12 @@
# and layouts whose dependencies should be managed
def initialize(objects)
super('tmp/dependencies', 4)
@objects = objects
-
- @graph = Nanoc::DirectedGraph.new([ nil ] + @objects)
+ @graph = Nanoc::DirectedGraph.new([ nil ] + @objects)
+ @stack = []
end
# Starts listening for dependency messages (`:visit_started` and
# `:visit_ended`) and start recording dependencies.
#
@@ -71,9 +71,17 @@
# @return [void]
def stop
# Unregister
Nanoc::NotificationCenter.remove(:visit_started, self)
Nanoc::NotificationCenter.remove(:visit_ended, self)
+ end
+
+ # @return The topmost item on the stack, i.e. the one currently being
+ # compiled
+ #
+ # @api private
+ def top
+ @stack.last
end
# Returns the direct dependencies for the given object.
#
# The direct dependencies of the given object include the items and