Class: Gullah::Dotifier
- Inherits:
-
Object
- Object
- Gullah::Dotifier
- Defined in:
- lib/gullah/dotifier.rb
Overview
A little tool to help visualize a parse tree. It generates .dot files parsable by graphviz. If you have graphviz installed, you may be able to invoke it like so and generate a .png file
Gullah::Dotifier.dot parses.first, "tree", make_it: :so
This will generate a file called tree.png showing the parse tree. If you don’t have graphviz, or perhaps if you’re on a machine which doesn’t like the command this generates – I suspect Windows doesn’t – you can skip the named argument and just generate the dot file which you can feed into graphviz some other way.
I make no guarantees about this utility. You may want to build your own, in which case this can serve as a simple prototype.
Class Method Summary collapse
-
.dot(parse, file, make_it: false, type: 'png') ⇒ Object
Receives a parse and a file name and generates a graph specification readable by graphviz.
Class Method Details
.dot(parse, file, make_it: false, type: 'png') ⇒ Object
Receives a parse and a file name and generates a graph specification readable by graphviz. The specification is written to a file with the specified file name. If make_it is truthy, the dot command will also be invoked and the graph image generated. By default this will be a png, though the type is specifiable via the type named argument.
25 26 27 |
# File 'lib/gullah/dotifier.rb', line 25 def self.dot(parse, file, make_it: false, type: 'png') new.send :dot, parse, file, make_it, type end |