Class: Rake::InvocationChain
- Inherits:
-
Object
- Object
- Rake::InvocationChain
- Defined in:
- lib/rake/invocation_chain.rb
Overview
InvocationChain tracks the chain of task invocations to detect circular dependencies.
Class Method Summary collapse
Instance Method Summary collapse
- #append(value) ⇒ Object
-
#initialize(value, tail) ⇒ InvocationChain
constructor
A new instance of InvocationChain.
- #member?(obj) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(value, tail) ⇒ InvocationChain
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 |