module Athena::Console::Question::Base(T)

Overview

Common logic shared between all question types. See each type for more information.

Direct including types

Defined in:

question/base.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(question : String, default : T) #

[View source]

Instance Method Detail

def default : T #

Returns the default value if no valid input is provided.


[View source]
def hidden=(hidden : Bool) : self #

Sets if the answer should be hidden. See [Hiding User Input][Athena::Console::Question--hiding-user-input].


[View source]
def hidden? : Bool #

Returns the answer should be hidden. See [Hiding User Input][Athena::Console::Question--hiding-user-input].


[View source]
def hidden_fallback=(hidden_fallback : Bool) #

If hidden questions should fallback on making the response visible if it was unable to be hidden. See [Hiding User Input][Athena::Console::Question--hiding-user-input].


[View source]
def hidden_fallback? : Bool #

If hidden questions should fallback on making the response visible if it was unable to be hidden. See [Hiding User Input][Athena::Console::Question--hiding-user-input].


[View source]
def max_attempts : Int32 | Nil #

Returns how many attempts the user has to enter a valid value when a #validator is set. See [Validating the Answer][Athena::Console::Question--validating-the-answer].


[View source]
def max_attempts=(attempts : Int32 | Nil) : self #

Allow at most attempts for the user to enter a valid value when a #validator is set. If attempts is nil, they have an unlimited amount.

See [Validating the Answer][Athena::Console::Question--validating-the-answer].


[View source]
def multi_line=(multi_line : Bool) #

If multi line text should be allowed in the response. See [Multiline Input][Athena::Console::Question--multiline-input].


[View source]
def multi_line? : Bool #

If multi line text should be allowed in the response. See [Multiline Input][Athena::Console::Question--multiline-input].


[View source]
def normalizer : Proc(T | String, T) | Nil #

See [Normalizing the Answer][Athena::Console::Question--normalizing-the-answer].


[View source]
def normalizer(&normalizer : T | String -> T) : Nil #

Sets the normalizer callback to this block. See [Normalizing the Answer][Athena::Console::Question--normalizing-the-answer].


[View source]
def normalizer=(normalizer : Proc(T | String, T) | Nil) #

See [Normalizing the Answer][Athena::Console::Question--normalizing-the-answer].


[View source]
def question : String #

Returns the question that should be asked.


[View source]
def trimmable=(trimmable : Bool) #

Returns/sets if the answer value should be automatically trimmed. See [Trimming the Answer][Athena::Console::Question--trimming-the-answer].


[View source]
def trimmable? : Bool #

Returns/sets if the answer value should be automatically trimmed. See [Trimming the Answer][Athena::Console::Question--trimming-the-answer].


[View source]