class Kaibaibo::Player

Attributes

name[R]
status[R]

Public Class Methods

get_name() click to toggle source
# File lib/kaibaibo/player.rb, line 13
def self.get_name
  puts "What's your name?"
  gets.chomp
end
new(name = "mister_no_name") click to toggle source
# File lib/kaibaibo/player.rb, line 4
def initialize(name = "mister_no_name")
  @name = name
  @status = nil
end

Public Instance Methods

gather_choice() click to toggle source
# File lib/kaibaibo/player.rb, line 18
def gather_choice
  puts "#{@name}, enter your choice"
  choice = gets.strip
  case choice
  when "rock"
    throw(:rock)
  when "paper"
    throw(:paper)
  when "scissors"
    throw(:scissors)
  else
    puts "Incorrect input"
    gather_choice
  end
end
throw(choice) click to toggle source
# File lib/kaibaibo/player.rb, line 9
def throw(choice)
  @status = choice
end