Class: Rake::InvocationChain
- Inherits:
-
LinkedList
- Object
- LinkedList
- Rake::InvocationChain
- Defined in:
- lib/rake/invocation_chain.rb
Overview
InvocationChain tracks the chain of task invocations to detect circular dependencies.
Defined Under Namespace
Classes: EmptyInvocationChain
Instance Attribute Summary
Attributes inherited from LinkedList
Class Method Summary collapse
-
.append(invocation, chain) ⇒ Object
Class level append.
Instance Method Summary collapse
-
#append(invocation) ⇒ Object
Append an invocation to the chain of invocations.
-
#member?(invocation) ⇒ Boolean
Is the invocation already in the chain?.
-
#to_s ⇒ Object
Convert to string, ie: TOP => invocation => invocation.
Methods inherited from LinkedList
#==, #conj, cons, #each, empty, #empty?, #initialize, #inspect, make
Constructor Details
This class inherits a constructor from Rake::LinkedList
Class Method Details
.append(invocation, chain) ⇒ Object
Class level append.
27 28 29 |
# File 'lib/rake/invocation_chain.rb', line 27 def self.append(invocation, chain) chain.append(invocation) end |
Instance Method Details
#append(invocation) ⇒ Object
Append an invocation to the chain of invocations. It is an error if the invocation already listed.
14 15 16 17 18 19 |
# File 'lib/rake/invocation_chain.rb', line 14 def append(invocation) if member?(invocation) fail RuntimeError, "Circular dependency detected: #{to_s} => #{invocation}" end conj(invocation) end |
#member?(invocation) ⇒ Boolean
Is the invocation already in the chain?
8 9 10 |
# File 'lib/rake/invocation_chain.rb', line 8 def member?(invocation) head == invocation || tail.member?(invocation) end |
#to_s ⇒ Object
Convert to string, ie: TOP => invocation => invocation
22 23 24 |
# File 'lib/rake/invocation_chain.rb', line 22 def to_s "#{prefix}#{head}" end |