lib/cliprompt/optionset.rb in cliprompt-0.0.5 vs lib/cliprompt/optionset.rb in cliprompt-0.0.6
- old
+ new
@@ -155,9 +155,10 @@
answer
end
def check_list(question, answer)
return ask_again(question, Cliprompt::MSG_CHOSE_IN_LIST) unless answer.to_i < @choices.count
+ return ask_again(question, Cliprompt::MSG_INPUT_A_NUMBER) unless /[0-9]+/.match(answer)
@choices[answer.to_i]
end
def ask_again(question, msg)
Cliprompt.shout msg