Ruby AST Visualizer. Based on Parser.
Install
$ gem install ruby_ast_visualizerUsage
An example ruby_ast_visualizer command.
$ cat hello.rb
puts 'hello, world'
$ ruby_ast_visualizer hello.rb
(send nil :puts
(str "hello, world"))
Wrote a.pngor
$ ruby_ast_visualizer -e 'puts "hello, world"'
(send nil :puts
(str "hello, world"))
Wrote a.pngAST image file is generated.
A little more in detail
You can specify output path in the -o option. That value is default a.png.
$ ruby_ast_visualizer -o path/to/file -e 'puts "hello, world"'
(send nil :puts
(str "hello, world"))
Wrote path/to/fileAnd you can also specify the -n (--no-image) option if you don't need an image.
You can only get the result of S-expression by Parser gem.
$ ruby_ast_visualizer -n -e 'puts "hello, world"'
(send nil :puts
(str "hello, world"))Requirements
- Graphviz
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
License
Ruby AST Visualizer is released under the GNU General Public License, version 2.
