Class: SyntaxTree::CLI::Doc

Inherits:
Action
  • Object
show all
Defined in:
lib/syntax_tree/cli.rb

Overview

An action of the CLI that prints out the doc tree IR for the given source.

Instance Method Summary collapse

Methods inherited from Action

#failure, #success

Instance Method Details

#run(item) ⇒ Object



140
141
142
143
144
145
146
# File 'lib/syntax_tree/cli.rb', line 140

def run(item)
  source = item.source

  formatter = Formatter.new(source, [])
  item.handler.parse(source).format(formatter)
  pp formatter.groups.first
end