Method: Executable::Utils#ask
- Defined in:
- lib/executable/utils.rb
#ask(question, options = {}) ⇒ Object
Query the user for an answer.
29 30 31 32 33 34 35 36 37 |
# File 'lib/executable/utils.rb', line 29 def ask(question, ={}) print "#{question} [default: #{[:default]}] " reply = STDIN.readline.chomp if reply.empty? [:default] else reply end end |