Class: SyntaxTree::CLI::Json
Overview
An action of the CLI that converts the source into its equivalent JSON representation.
Instance Method Summary collapse
Methods inherited from Action
Instance Method Details
#run(item) ⇒ Object
181 182 183 184 |
# File 'lib/syntax_tree/cli.rb', line 181 def run(item) object = Visitor::JSONVisitor.new.visit(item.handler.parse(item.source)) puts JSON.pretty_generate(object) end |