Class: SC::InvocationChain
- Inherits:
-
Object
- Object
- SC::InvocationChain
show all
- Defined in:
- lib/sproutcore/buildfile/invocation_chain.rb
Overview
InvocationChain tracks the chain of task invocations to detect circular dependencies. Borrowed from Rake 0.8.3
Defined Under Namespace
Classes: EmptyInvocationChain
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of InvocationChain.
13
14
15
16
|
# File 'lib/sproutcore/buildfile/invocation_chain.rb', line 13
def initialize(value, tail)
@value = value
@tail = tail
end
|
Class Method Details
.append(value, chain) ⇒ Object
37
38
39
|
# File 'lib/sproutcore/buildfile/invocation_chain.rb', line 37
def self.append(value, chain)
chain.append(value)
end
|
Instance Method Details
#already_invoked?(task) ⇒ Boolean
22
23
24
|
# File 'lib/sproutcore/buildfile/invocation_chain.rb', line 22
def already_invoked?(task)
(task == @value) || @tail.already_invoked?(task)
end
|
#append(value) ⇒ Object
26
27
28
29
30
31
|
# File 'lib/sproutcore/buildfile/invocation_chain.rb', line 26
def append(value)
if member?(value)
raise "Circular dependency detected: #{to_s} => #{value}"
end
self.class.new(value, self)
end
|
#member?(obj) ⇒ Boolean
18
19
20
|
# File 'lib/sproutcore/buildfile/invocation_chain.rb', line 18
def member?(obj)
@value == obj || @tail.member?(obj)
end
|
#to_s ⇒ Object
33
34
35
|
# File 'lib/sproutcore/buildfile/invocation_chain.rb', line 33
def to_s
"#{prefix}#{@value}"
end
|