Crab::Promptn
A class to better handle the user input It is used to create a prompt with a text This class is a subclass of Crab::Prompt that returns a float
Constructors
Create a new Prompt object It's parameters are: text: The text to be display with the prompt, it can have crab codes is_password: A boolean to set if the prompt is a password, default is false options: An array of strings with the options to be display, default is [], example ["yes", "no"]
Instance methods
A method to ask the user for an answer It prints the text and the options if they are set It returns the answer if it is valid It uses the check_answer method to check if the answer is valid
A methos to make sure the prompt is valid It checks if the answer is valid, if not it asks again It returns the answer if it is valid