Class: DevSuite::DirectoryTree::Renderer::Simple
- Inherits:
-
Base
- Object
- Utils::Construct::Component::Base
- Base
- DevSuite::DirectoryTree::Renderer::Simple
- Defined in:
- lib/dev_suite/directory_tree/renderer/simple.rb
Constant Summary collapse
- LAST_NODE_CONNECTOR =
The characters are used to draw the tree structure
└ (U+2514) is the L-shaped corner character ├ (U+251C) is the L-shaped corner character │ (U+2502) is the vertical line character ─ (U+2500) is the horizontal line character (U+00A0) is the non-breaking space character | (U+007C) is the vertical line character
(U+0020) is the space character
"└── "
- NODE_CONNECTOR =
"├── "
- INDENT =
" "
- PIPE =
"│ "
Instance Method Summary collapse
Methods inherited from Utils::Construct::Component::Base
Instance Method Details
#render(node:, prefix: "", is_last: true, depth: 0) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dev_suite/directory_tree/renderer/simple.rb', line 21 def render(node:, prefix: "", is_last: true, depth: 0) return "" if skip_node?(node) || exceeds_max_depth?(depth) output = node_line(node: node, prefix: prefix, is_last: is_last) if node.directory? && node.children.any? output += render_children(node: node, prefix: prefix, is_last: is_last, depth: depth) end output end |