class Athena::Console::Formatter::Output
- Athena::Console::Formatter::Output
- Reference
- Object
Overview
Default implementation of ACON::Formatter::WrappableInterface
.
Included Modules
Defined in:
formatter/output.crConstructors
Class Method Summary
-
.escape(text : String) : String
Returns a new string where the special
<
characters in the provided text are escaped. -
.escape_trailing_backslash(text : String) : String
Returns a new string where trailing
\
in the provided text is escaped.
Instance Method Summary
-
#decorated=(decorated : Bool)
Sets if output messages should be decorated.
-
#decorated? : Bool
Returns
true
if output messages will be decorated, otherwisefalse
. -
#format(message : String | Nil) : String
Formats the provided message according to the stored styles.
-
#format_and_wrap(message : String | Nil, width : Int32) : String
Formats the provided message according to the defined styles, wrapping it at the provided width.
-
#has_style?(name : String) : Bool
Returns
true
ifself
has a style with the provided name, otherwisefalse
. -
#set_style(name : String, style : ACON::Formatter::OutputStyleInterface) : Nil
Assigns the provided style to the provided name.
-
#style(name : String) : ACON::Formatter::OutputStyleInterface
Returns an
ACON::Formatter::OutputStyleInterface
with the provided name.
Instance methods inherited from module Athena::Console::Formatter::WrappableInterface
format_and_wrap(message : String | Nil, width : Int32) : String
format_and_wrap
Instance methods inherited from module Athena::Console::Formatter::Interface
decorated=(decorated : Bool)
decorated=,
decorated? : Bool
decorated?,
format(message : String | Nil) : String
format,
has_style?(name : String) : Bool
has_style?,
set_style(name : String, style : ACON::Formatter::OutputStyleInterface) : Nil
set_style,
style(name : String) : ACON::Formatter::OutputStyleInterface
style
Constructor Detail
Class Method Detail
Returns a new string where the special <
characters in the provided text are escaped.
Returns a new string where trailing \
in the provided text is escaped.
Instance Method Detail
Formats the provided message according to the stored styles.
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
Returns true
if self
has a style with the provided name, otherwise false
.
Assigns the provided style to the provided name.
Returns an ACON::Formatter::OutputStyleInterface
with the provided name.