Class: SyntaxTree::CLI::Json
Overview
An action of the CLI that converts the source into its equivalent JSON representation.
Instance Attribute Summary
Attributes inherited from Action
Instance Method Summary collapse
Methods inherited from Action
#failure, #initialize, #success
Constructor Details
This class inherits a constructor from SyntaxTree::CLI::Action
Instance Method Details
#run(item) ⇒ Object
176 177 178 179 |
# File 'lib/syntax_tree/cli.rb', line 176 def run(item) object = Visitor::JSONVisitor.new.visit(item.handler.parse(item.source)) puts JSON.pretty_generate(object) end |