Skip to content

abstract class Athena::Console::Question::AbstractChoice(T, ChoiceType)
inherits Reference #

Base type of choice based questions. See each subclass for more information.

Included modules

Athena::Console::Question::Base

Direct known subclasses

Athena::Console::Question::Choice(T) Athena::Console::Question::MultipleChoice(T)

Constructors#

.new(question : String, choices : Indexable(T), default : Int | T | Nil = nil)#

View source

.new(question : String, choices : Hash(String | Int32, T), default : T? = nil)#

View source

Methods#

#choices : Hash(String | Int32, T)#

Returns the possible choices.

View source

#error_message : String#

Returns the message to display if the provided answer is not a valid choice.

View source

#error_message=(error_message : String) : self#

View source

#prompt : String#

Returns/sets the prompt to use for the question. The prompt being the character(s) before the user input.

View source

#prompt=(prompt : String)#

Returns/sets the prompt to use for the question. The prompt being the character(s) before the user input.

View source

#validator : Proc(T | ::Nil, ChoiceType) | ::Nil#

View source

#validator : Nil#

Sets the validator callback to the provided block. See Validating the Answer.

View source

#validator=(validator : Proc(T?, ChoiceType)?)#

View source