Sha256: 4265d0394e638f5fb01feaadcbc790b44a3d5819a49d467ce859e482daf9e0c5
Contents?: true
Size: 1.37 KB
Versions: 13
Compression:
Stored size: 1.37 KB
Contents
# =========================================================================== # Project: Abbot - SproutCore Build Tools # Copyright: ©2009 Apple, Inc. # portions copyright @2006-2009 Sprout Systems, Inc. # and contributors # =========================================================================== module SC # InvocationChain tracks the chain of task invocations to detect # circular dependencies. Borrowed from Rake 0.8.3 class InvocationChain def initialize(value, tail) @value = value @tail = tail end def member?(obj) @value == obj || @tail.member?(obj) end def already_invoked?(task) (task == @value) || @tail.already_invoked?(task) end def append(value) if member?(value) raise "Circular dependency detected: #{to_s} => #{value}" end self.class.new(value, self) end def to_s "#{prefix}#{@value}" end def self.append(value, chain) chain.append(value) end private def prefix "#{@tail.to_s} => " end class EmptyInvocationChain def member?(obj) false end def append(value) InvocationChain.new(value, self) end def to_s "TOP" end def already_invoked?(task); false; end end EMPTY = EmptyInvocationChain.new end # class InvocationChain end
Version data entries
13 entries across 13 versions & 1 rubygems