Module: Taski::Progress::Layout::Tree

Defined in:
lib/taski/progress/layout/tree.rb,
lib/taski/progress/layout/tree/live.rb,
lib/taski/progress/layout/tree/event.rb,
lib/taski/progress/layout/tree/structure.rb

Overview

Tree layout module for hierarchical task display. Renders tasks in a tree structure with visual connectors.

Contains two implementations:

  • Tree::Live — TTY periodic-update with spinner animation
  • Tree::Event — Non-TTY event-driven incremental output

Use Tree.for to automatically select the appropriate implementation.

Examples:

Auto-select based on output TTY

layout = Taski::Progress::Layout::Tree.for

Explicit selection

layout = Taski::Progress::Layout::Tree::Live.new   # TTY
layout = Taski::Progress::Layout::Tree::Event.new  # non-TTY

Defined Under Namespace

Modules: Structure Classes: Event, Live

Class Method Summary collapse

Class Method Details

.for(output: $stderr, theme: nil) ⇒ Tree::Live, Tree::Event

Factory method to create the appropriate tree layout. Returns Tree::Live for TTY outputs, Tree::Event otherwise.

Parameters:

  • output (IO) (defaults to: $stderr)

    Output stream (default: $stderr)

  • theme (Theme::Base, nil) (defaults to: nil)

    Theme instance

Returns:



32
33
34
35
36
37
38
# File 'lib/taski/progress/layout/tree.rb', line 32

def self.for(output: $stderr, theme: nil)
  if output.respond_to?(:tty?) && output.tty?
    Live.new(output: output, theme: theme)
  else
    Event.new(output: output, theme: theme)
  end
end