class Athena::Console::Formatter::Output

Overview

Default implementation of ACON::Formatter::WrappableInterface.

Included Modules

Defined in:

formatter/output.cr

Constructors

Class Method Summary

Instance Method Summary

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

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

[View source]

Class Method Detail

def self.escape(text : String) : String #

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


[View source]
def self.escape_trailing_backslash(text : String) : String #

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


[View source]

Instance Method Detail

def decorated=(decorated : Bool) #

Sets if output messages should be decorated.


[View source]
def decorated? : Bool #

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


[View source]
def format(message : String | Nil) : String #

Formats the provided message according to the stored styles.


[View source]
def 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]
def has_style?(name : String) : Bool #

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


[View source]
def set_style(name : String, style : ACON::Formatter::OutputStyleInterface) : Nil #

Assigns the provided style to the provided name.


[View source]
def style(name : String) : ACON::Formatter::OutputStyleInterface #

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


[View source]