Module: PrivateMethods
- Defined in:
- lib/ref/PrivateMethods.rb
Class Method Summary collapse
Class Method Details
.final_outcome(pl, co) ⇒ Object
19 20 21 22 23 |
# File 'lib/ref/PrivateMethods.rb', line 19 def final_outcome(pl, co) return :WIN if pl > co; return :LOSE if pl < co; return :TIE if pl = co; end |
.player_choice ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/ref/PrivateMethods.rb', line 6 def player_choice loop do print ColorizedString["Choose rock (r), paper (p) or scissors (s): "].colorize(:green); choice = gets.chomp.downcase; return Constants::NTRY_TO_SYM[choice] if Constants::NTRY_TO_SYM.key?(choice); puts ColorizedString["That entry is invalid. Please re-enter"].colorize(:green); end; end |
.player_outcome(plays) ⇒ Object
14 15 16 17 18 |
# File 'lib/ref/PrivateMethods.rb', line 14 def player_outcome(plays) return :WIN if Constants::WINNERS.include?(plays); return :LOSE if Constants::LOSERS.include?(plays); return :TIE if (!:WIN || !:LOSE); end |