class Nanoc::Core::Errors::DependencyCycle

Error that is raised during site compilation when an item (directly or indirectly) includes its own item content, leading to endless recursion.

Public Class Methods

new(stack) click to toggle source
Calls superclass method
# File lib/nanoc/core/errors.rb, line 75
def initialize(stack)
  start_idx = stack.index(stack.last)
  cycle = stack[start_idx..-2]

  msg_bits = []
  msg_bits << 'The site cannot be compiled because there is a dependency cycle:'
  msg_bits << ''
  cycle.each.with_index do |r, i|
    msg_bits << "    (#{i + 1}) item #{r.item.identifier}, rep #{r.name.inspect}, uses compiled content of"
  end
  msg_bits << msg_bits.pop + ' (1)'

  super(msg_bits.map { |x| x + "\n" }.join(''))
end