Installation

Termline provides formatted terminal output for Ruby applications, scripts, Rake tasks, and command-line tools. It has no runtime gem dependencies and does not require Rails.

Requirements

Termline supports Ruby 3.3 or newer. The release workflow uses Ruby 3.3.5.

Add it to the current bundle:

bundle add termline

Require the gem when Bundler does not load it automatically:

require "termline"

Verify the installation:

Termline.success "Termline is ready"

Output and terminal detection

The public helpers write to $stdout by default. Assign another IO-compatible object to Termline.output when output needs to be captured or redirected:

require "stringio"

buffer = StringIO.new
Termline.output = buffer
Termline.ansi = false

Termline.success "Saved", time: false
buffer.string # => "✔ SUCCESS: Saved\n"

ANSI mode defaults to :auto. In automatic mode, styling is enabled only for an interactive output and is disabled when NO_COLOR is present or TERM=dumb. Set Termline.ansi to true or false when deterministic output is required.

Terminal width is detected from the configured output, COLUMNS, or the system console and falls back to 80 columns. Override or reset it with:

Termline.width = 100
Termline.width = nil # Resume automatic detection

Begin with Messages, then use Lists, Tables, Text components, and Separators and spacing as needed.

 Edit this page

Last Update: 2026/10/23