module Mybot::Helpers

Public Instance Methods

ask(q = "") click to toggle source
# File lib/mybot/helpers.rb, line 10
def ask(q = "")
  print_cmd "ask", q, :blue, :bold
  $stdin.gets.chomp
end
wait(msg = "Press any key to continue...") click to toggle source
# File lib/mybot/helpers.rb, line 5
def wait(msg = "Press any key to continue...")
  print_cmd "wait", msg, :blue, :bold
  $stdin.gets
end
yes?(q = "") click to toggle source
# File lib/mybot/helpers.rb, line 15
def yes?(q = "")
  result = ""
  loop do
    print_cmd "ask", q, :blue, :bold
    result = $stdin.gets.chomp
    break if result =~ /y|yes|Y|YES|Yes|n|no|N|NO|No/
  end

  result =~ /y|yes|Y|YES|Yes/
end