Class: Agentilda::Diagram

Inherits:
Object
  • Object
show all
Includes:
UI
Defined in:
lib/agentilda/diagram.rb

Overview

agentilda states — the state machine as a terminal picture.

Documentation already renders this machine as a Markdown table and a mermaid block, for a browser. This is the same machine, walked the same way, shaped for a terminal instead: unicode arrows, no browser required.

Every section below is read off StateMachine and STATUSES rather than drawn by hand, for the reason Documentation gives for doing the same thing: three hand-maintained pictures of this machine have already drifted apart once, and a fourth is not the fix.

Constant Summary collapse

ARROW =

Drawn between two states on the same line.

"──▶"

Constants included from UI

UI::MAX_WIDTH, UI::METER_WIDTH, UI::MIN_WIDTH, UI::NO_FAILURE, UI::NO_FIELDS, UI::NO_TIMEOUT, UI::PROGRESS_THRESHOLD, UI::TIMER_WARNING, UI::TIMER_WIDTH

Instance Method Summary collapse

Methods included from UI

abbreviate, activity_for, animate?, box, box_height, color?, concurrently, countdown, default_jobs, display_width, elapsed, #error, fit, #info, line, log, logging_activity, meter, monotonic, once, paint, #paint, pastel, popup, report_line, reset!, said, #say, solo_spinner, spinning, stepping, #success, threaded, tty?, #warn, width

Instance Method Details

#renderString

Returns the whole diagram, newline-terminated.

Returns:

  • (String)

    the whole diagram, newline-terminated



21
22
23
24
25
26
27
28
29
30
# File 'lib/agentilda/diagram.rb', line 21

def render
  [
    heading,
    spine_section,
    rejoin_section,
    other_section,
    terminal_section,
    family_section
  ].compact.join("\n\n") + "\n"
end