I have a simple CLI, something like:
p 'Enter email value'
params[:email] = gets.chomp
and I want to handle email validation and if the email is invalid then rerun the previous prompt.
I have method for validating email, that simply returns true or false, something like:
p 'Enter email value'
params[:email] = gets.chomp
if email invalid
'error- invalid email'
and again run
p 'Enter email value'
params[:email] = gets.chomp
How can I do it?