123456789_123456789_123456789_123456789_123456789_

Class: Rake::InvocationChain

Relationships & Source Files
Namespace Children
Classes:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, LinkedList
Instance Chain:
self, LinkedList, Enumerable
Inherits: Rake::LinkedList
Defined in: lib/rake/invocation_chain.rb

Overview

InvocationChain tracks the chain of task invocations to detect circular dependencies.

Constant Summary

LinkedList - Inherited

EMPTY

Class Method Summary

LinkedList - Inherited

.cons

Cons a new head onto the tail list.

.empty

The standard empty list class for the given LinkedList class.

.make

Make a list out of the given arguments.

.new

Instance Attribute Summary

LinkedList - Inherited

#empty?

Is the list empty? .make guards against a list being empty making any instantiated LinkedList object not empty by default You should consider overriding this method if you implement your own .make method.

#head, #tail

Instance Method Summary

LinkedList - Inherited

#==

Lists are structurally equivalent.

#conj

Polymorphically add a new element to the head of a list.

#each

For each item in the list.

#inspect

Same as #to_s, but with inspected items.

#to_s

Convert to string: LL(item, item…).

Constructor Details

This class inherits a constructor from Rake::LinkedList

Class Method Details

.append(invocation, chain)

Class level append.

[ GitHub ]

  
# File 'lib/rake/invocation_chain.rb', line 28

def self.append(invocation, chain)
  chain.append(invocation)
end

Instance Method Details

#append(invocation)

Append an invocation to the chain of invocations. It is an error if the invocation already listed.

[ GitHub ]

  
# 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?

[ GitHub ]

  
# File 'lib/rake/invocation_chain.rb', line 9

def member?(invocation)
  head == invocation || tail.member?(invocation)
end

#prefix (private)

[ GitHub ]

  
# File 'lib/rake/invocation_chain.rb', line 34

def prefix
  "#{tail} => "
end

#to_s

Convert to string, ie: TOP => invocation => invocation

[ GitHub ]

  
# File 'lib/rake/invocation_chain.rb', line 23

def to_s
  "#{prefix}#{head}"
end