class

Term2::Components::Tree

Inherits Reference < Object

Tree is a static renderer for hierarchical tree structures. Unlike the interactive List component, Tree is for display-only rendering.

Example:

tree = Tree.new("root")
  .child("child1")
  .child(
    Tree.new("child2")
      .child("grandchild1")
      .child("grandchild2")
  )
  .child("child3")

puts tree.render
# root
# ├── child1
# ├── child2
# │   ├── grandchild1
# │   └── grandchild2
# └── child3

Constructors

new(root : String = "") : Tree

Create a new tree with a root value

Source
root(root : String) : Tree

Create a tree with a root value (alias for new)

Source

Nested types