Class Airbrussh::Console
In: lib/airbrussh/console.rb
Parent: Object

Helper class that wraps an IO object and provides methods for truncating output, assuming the IO object represents a console window.

This is useful for writing log messages that will typically show up on an ANSI color-capable console. When a console is not present (e.g. when running on a CI server) the output will gracefully degrade.

Methods

Attributes

config  [R] 
output  [R] 

Public Class methods

Public Instance methods

<<(string)

Alias for write

Writes to the IO after first truncating the output to fit the console width. If the underlying IO is not a TTY, ANSI colors are removed from the output. A newline is always added. Color output can be forced by setting the SSHKIT_COLOR environment variable.

Writes directly through to the IO with no truncation or color logic. No newline is added.

[Validate]