Class: Rake::InvocationChain
- Inherits:
-
Object
- Object
- Rake::InvocationChain
show all
- Defined in:
- lib/rake/invocation_chain.rb
Overview
InvocationChain tracks the chain of task invocations to detect circular dependencies.
Defined Under Namespace
Classes: EmptyInvocationChain
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of InvocationChain.
7
8
9
10
|
# File 'lib/rake/invocation_chain.rb', line 7
def initialize(value, tail)
@value = value
@tail = tail
end
|
Class Method Details
.append(value, chain) ⇒ Object
27
28
29
|
# File 'lib/rake/invocation_chain.rb', line 27
def self.append(value, chain)
chain.append(value)
end
|
Instance Method Details
#append(value) ⇒ Object
16
17
18
19
20
21
|
# File 'lib/rake/invocation_chain.rb', line 16
def append(value)
if member?(value)
fail RuntimeError, "Circular dependency detected: #{to_s} => #{value}"
end
self.class.new(value, self)
end
|
#member?(obj) ⇒ Boolean
12
13
14
|
# File 'lib/rake/invocation_chain.rb', line 12
def member?(obj)
@value == obj || @tail.member?(obj)
end
|
#to_s ⇒ Object
23
24
25
|
# File 'lib/rake/invocation_chain.rb', line 23
def to_s
"#{prefix}#{@value}"
end
|