Module: Inversion::CLI::TreeCommand
- Extended by:
- Subcommand
- Defined in:
- lib/inversion/cli/tree.rb
Overview
Tree command
Class Method Summary collapse
-
.dump_node_trees(templates) ⇒ Object
Dump the node tree of the given ‘templates`.
-
.output_template_nodes(tree, indent = 0) ⇒ Object
Output the given ‘tree` of nodes at the specified `indent` level.
Methods included from Subcommand
display_list, display_table, error_string, exit_now!, extended, headline_string, help_now!, highlight_string, hl, load_template, output_blank_line, output_subheader, output_template_header, prompt, success_string, unless_dryrun, visible_chars
Class Method Details
.dump_node_trees(templates) ⇒ Object
Dump the node tree of the given ‘templates`.
50 51 52 53 54 55 56 57 |
# File 'lib/inversion/cli/tree.rb', line 50 def dump_node_trees( templates ) templates.each do |path| template = self.load_template( path ) self.output_blank_line self.output_template_header( template ) self.output_template_nodes( template.node_tree ) end end |
.output_template_nodes(tree, indent = 0) ⇒ Object
Output the given ‘tree` of nodes at the specified `indent` level.
40 41 42 43 44 45 46 |
# File 'lib/inversion/cli/tree.rb', line 40 def output_template_nodes( tree, indent=0 ) indenttxt = ' ' * indent tree.each do |node| self.prompt.say( indenttxt + node.as_comment_body ) self.output_template_nodes( node.subnodes, indent+4 ) if node.is_container? end end |