Class: WiesenbergGemBuildingPractice::RockPaperScissors::Human
- Defined in:
- lib/wiesenberg_gem_building_practice.rb
Overview
class Player
Instance Attribute Summary
Attributes inherited from Player
Instance Method Summary collapse
Methods inherited from Player
Constructor Details
This class inherits a constructor from WiesenbergGemBuildingPractice::RockPaperScissors::Player
Instance Method Details
#choose_handshape ⇒ Object
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/wiesenberg_gem_building_practice.rb', line 128 def choose_handshape puts "\n #{@name}, choose your handshape - Rock, Paper, Scissors (R, P or S)." print " (Your answer will not be shown to keep it secret from your opponent.): " until %w(R P S).include? (answer = STDIN.noecho(&:gets).chomp) print " Incorrect answer - try again: " end puts case answer when "R" @handshape = :rock when "P" @handshape = :paper when "S" @handshape = :scissors end @handshape end |