class Invoker::CLI::Question

Public Class Methods

agree(question_text) click to toggle source
# File lib/invoker/cli/question.rb, line 3
def self.agree(question_text)
  $stdout.print(question_text)
  answer = $stdin.gets
  answer.strip!
  if answer =~ /\Ay(?:es)?|no?\Z/i
    answer =~ /\Ay(?:es)?\Z/i
  else
    $stdout.puts "Please enter 'yes' or 'no'."
    agree(question_text)
  end
end