JEG2 / highline

A higher level command-line oriented interface.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Have to set convert type in order for `.in` to work with array

esotericpig opened this issue · comments

If you do this, no validation happens:

ask('Letter a, b, or c? ') { |q| q.in = %w[ a b c ] }

You can enter in d, and it accepts the input.

In order for it to work, you have to pass in String:

ask('Letter a, b, or c? ',String) { |q| q.in = %w[ a b c ] }

Is there another way I should do this (I don't want a full-blown menu like with choose)? Else, I think it'd be useful to change it.