Skip to content

class Athena::Console::Question::Confirmation
inherits Athena::Console::Question #

Allows prompting the user to confirm an action.

question = "Continue with this action?", false

if !helper.ask input, output, question
  return ACON::Command::Status::SUCCESS

# ...

In this example the user will be asked if they wish to Continue with this action. The #ask method will return true if the user enters anything starting with y, otherwise false.


.new(question : String, default : Bool = true, true_answer_regex : Regex = /^y/i)#

Creates a new instance of self with the provided question string. The default parameter represents the value to return if no valid input was entered. The true_answer_regex can be used to customize the pattern used to determine if the user's input evaluates to true.

View source