Skip to content

class Athena::Console::Formatter::Output
inherits Reference #

Default implementation of ACON::Formatter::WrappableInterface.

Included modules

Athena::Console::Formatter::WrappableInterface

Constructors#

.new(decorated : Bool = false, styles : Colorize::Mode | Nil = nil)#

View source

Class methods#

.escape(text : String) : String#

Returns a new string where the special < characters in the provided text are escaped.

View source

.escape_trailing_backslash(text : String) : String#

Returns a new string where trailing \ in the provided text is escaped.

View source

Methods#

#decorated=(decorated : Bool)#

Sets if output messages should be decorated.

View source

#decorated? : Bool#

Returns true if output messages will be decorated, otherwise false.

View source

#format(message : String | Nil) : String#

Formats the provided message according to the stored styles.

View source

#format_and_wrap(message : String | Nil, width : Int32) : String#

Formats the provided message according to the defined styles, wrapping it at the provided width. A width of 0 means no wrapping. ameba:disable Metrics/CyclomaticComplexity

View source

#has_style?(name : String) : Bool#

Returns true if self has a style with the provided name, otherwise false.

View source

#set_style(name : String, style : ACON::Formatter::OutputStyleInterface) : Nil#

Assigns the provided style to the provided name.

View source

#style(name : String) : ACON::Formatter::OutputStyleInterface#

Returns an ACON::Formatter::OutputStyleInterface with the provided name.

View source