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, options={})
  print "#{question} [default: #{options[:default]}] "
  reply = STDIN.readline.chomp
  if reply.empty?
    options[:default]
  else
    reply
  end
end