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?, #inspect, make
Class Method Details
.append(invocation, chain) ⇒ Object
Class level append.
28 29 30 |
# File 'lib/rake/invocation_chain.rb', line 28 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.
15 16 17 18 19 20 |
# File 'lib/rake/invocation_chain.rb', line 15 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?
9 10 11 |
# File 'lib/rake/invocation_chain.rb', line 9 def member?(invocation) head == invocation || tail.member?(invocation) end |
#to_s ⇒ Object
Convert to string, ie: TOP => invocation => invocation
23 24 25 |
# File 'lib/rake/invocation_chain.rb', line 23 def to_s "#{prefix}#{head}" end |