abstract class Athena::Console::Question::AbstractChoice(T, ChoiceType)
- Athena::Console::Question::AbstractChoice(T, ChoiceType)
- Reference
- Object
Overview
Base type of choice based questions. See each subclass for more information.
Included Modules
Direct Known Subclasses
Defined in:
question/abstract_choice.crConstructors
- .new(question : String, choices : Indexable(T), default : Int | T | Nil = nil)
- .new(question : String, choices : Hash(String | Int32, T), default : T | Nil = nil)
Instance Method Summary
-
#choices : Hash(String | Int32, T)
Returns the possible choices.
-
#error_message : String
Returns the message to display if the provided answer is not a valid choice.
- #error_message=(error_message : String) : self
-
#prompt : String
Returns/sets the prompt to use for the question.
-
#prompt=(prompt : String)
Returns/sets the prompt to use for the question.
-
#validator : Proc(T | Nil, ChoiceType) | Nil
See [Validating the Answer][Athena::Console::Question--validating-the-answer].
-
#validator(&validator : T | Nil -> ChoiceType) : Nil
Sets the validator callback to the provided block.
-
#validator=(validator : Proc(T | Nil, ChoiceType) | Nil)
See [Validating the Answer][Athena::Console::Question--validating-the-answer].
Instance methods inherited from module Athena::Console::Question::Base(T?)
default : T?
default,
hidden=(hidden : Bool) : self
hidden=,
hidden? : Bool
hidden?,
hidden_fallback=(hidden_fallback : Bool)
hidden_fallback=,
hidden_fallback? : Bool
hidden_fallback?,
max_attempts : Int32 | Nil
max_attempts,
max_attempts=(attempts : Int32 | Nil) : self
max_attempts=,
multi_line=(multi_line : Bool)
multi_line=,
multi_line? : Bool
multi_line?,
normalizer : Proc(T? | String, T?) | Nilnormalizer(&normalizer : T? | String -> T?) : Nil normalizer, normalizer=(normalizer : Proc(T? | String, T?) | Nil) normalizer=, question : String question, trimmable=(trimmable : Bool) trimmable=, trimmable? : Bool trimmable?
Constructor methods inherited from module Athena::Console::Question::Base(T?)
new(question : String, default : T?)
new
Constructor Detail
Instance Method Detail
Returns the message to display if the provided answer is not a valid choice.
Returns/sets the prompt to use for the question. The prompt being the character(s) before the user input.
Returns/sets the prompt to use for the question. The prompt being the character(s) before the user input.
See [Validating the Answer][Athena::Console::Question--validating-the-answer].
Sets the validator callback to the provided block. See [Validating the Answer][Athena::Console::Question--validating-the-answer].
See [Validating the Answer][Athena::Console::Question--validating-the-answer].