Permalink
Browse files

remove unused code: Cause#ascii_tree

  • Loading branch information...
1 parent dc279b4 commit d20e051caed24bb1c2586be691147f40892cd0bb @jmettraux committed Apr 16, 2012
Showing with 0 additions and 30 deletions.
  1. +0 −30 lib/parslet/cause.rb
View
@@ -28,35 +28,5 @@ def raise(exception_klass=Parslet::ParseFailed)
exception = exception_klass.new(self.to_s, self)
Kernel.raise exception
end
-
- # Returns an ascii tree representation of the causes of this node and its
- # children.
- #
- def ascii_tree
- StringIO.new.tap { |io|
- recursive_ascii_tree(self, io, [true]) }.
- string
- end
-
- def children
- @children ||= Array.new
- end
- private
- def recursive_ascii_tree(node, stream, curved) # :nodoc:
- append_prefix(stream, curved)
- stream.puts node.to_s
-
- node.children.each do |child|
- last_child = (node.children.last == child)
-
- recursive_ascii_tree(child, stream, curved + [last_child])
- end
- end
- def append_prefix(stream, curved) # :nodoc:
- curved[0..-2].each do |c|
- stream.print c ? " " : "| "
- end
- stream.print curved.last ? "`- " : "|- "
- end
end
end

0 comments on commit d20e051

Please sign in to comment.