Method: Pc::Shell#choose
- Defined in:
- lib/pc/interfaces/shell.rb
#choose(choices = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pc/interfaces/shell.rb', line 23 def choose(choices = {}) if choices[:next] sleep 0.2 choices[:next] else say %{Pick one: #{choices.keys.join ' - '} } choice = gets.strip choices.select{|k,v| k.to_s == choice}.values.first || prompt(choices) end end |