abstract class Athena::Console::Helper
- Athena::Console::Helper
- Reference
- Object
Overview
Contains ACON::Helper::Interface
implementations that can be used to help with various tasks.
Such as asking questions, customizing the output format, or generating tables.
This class also acts as a base type that implements common functionality between each helper.
Included Modules
Direct Known Subclasses
Defined in:
helper/athena_question.crhelper/helper.cr
Class Method Summary
-
.format_time(span : Time::Span) : String
Formats the provided span of time as a human readable string.
-
.format_time(seconds : Number) : String
Formats the provided seconds as a human readable string.
-
.remove_decoration(formatter : ACON::Formatter::Interface, string : String) : String
Returns a new string with all of its ANSI formatting removed.
-
.width(string : String) : Int32
Returns the width of a string; where the width is how many character positions the string will use.
Instance Method Summary
-
#helper_set : ACON::Helper::HelperSet | Nil
Returns the
ACON::Helper::HelperSet
related toself
, if any. -
#helper_set=(helper_set : ACON::Helper::HelperSet | Nil)
Sets the
ACON::Helper::HelperSet
related toself
.
Instance methods inherited from module Athena::Console::Helper::Interface
helper_set : ACON::Helper::HelperSet | Nil
helper_set,
helper_set=(helper_set : ACON::Helper::HelperSet | Nil)
helper_set=
Class Method Detail
Formats the provided span of time as a human readable string.
ACON::Helper.format_time 10.seconds # => "10 secs"
ACON::Helper.format_time 4.minutes # => "4 mins"
ACON::Helper.format_time 74.minutes # => "1 hr"
Formats the provided seconds as a human readable string.
ACON::Helper.format_time 10 # => "10 secs"
ACON::Helper.format_time 240 # => "4 mins"
ACON::Helper.format_time 4400 # => "1 hr"
Returns a new string with all of its ANSI formatting removed.
Returns the width of a string; where the width is how many character positions the string will use.
TODO Support double width chars.
Instance Method Detail
Returns the ACON::Helper::HelperSet
related to self
, if any.
Sets the ACON::Helper::HelperSet
related to self
.