lib/deep_end.rb
def resolve_dependency(node)
      node.seen = true
      @seen_this_pass << node

      node.edges.each do |edge|
        unless @resolved.include? edge
          unless @seen_this_pass.include? edge
            unless edge.seen?
              resolve_dependency edge
            end
          else
            raise CircularDependencyError, "Circular reference detected: #{node.key.to_s} - #{edge.key.to_s}"
          end
        end
      end
      @resolved << node
    end
def resolve_dependency(node)
      node.seen = true
      @seen_this_pass << node

      node.edges.each do |edge|
        unless @resolved.include? edge
          unless @seen_this_pass.include? edge
            unless edge.seen?
              resolve_dependency edge
            end
          else
            raise CircularDependencyError, "Circular reference detected: #{node.key.to_s} - #{edge.key.to_s}"
          end
        end
      end
      @resolved << node
    end
Recurse through node edges