class TruthOrDare

Constants

ANSWERS
DARES
TRUTHS

Attributes

initial_choice[R]

Public Instance Methods

play() click to toggle source
# File lib/truth_or_dare.rb, line 75
def play
  print_welcome
  get_user_choice
  if valid_user_input?
    get_challenge
  else
    print_bad_input_message
    play
  end
end

Private Instance Methods

get_challenge() click to toggle source
# File lib/truth_or_dare.rb, line 106
def get_challenge
  case initial_choice
  when 't'
    puts TRUTHS.sample
    truth = gets.chomp
    puts ANSWERS.sample
  when 'd'
    puts DARES.sample
  end
end
get_user_choice() click to toggle source
# File lib/truth_or_dare.rb, line 97
def get_user_choice
  @initial_choice = gets.chomp.downcase.strip
end
print_bad_input_message() click to toggle source
print_welcome() click to toggle source
valid_user_input?() click to toggle source
# File lib/truth_or_dare.rb, line 101
def valid_user_input?
  initial_choice == 't' ||
  initial_choice == 'd'
end