Class: Bagel::Tennis::Player

Inherits:
Object
  • Object
show all
Defined in:
lib/bagel/tennis/player.rb

Constant Summary collapse

PLAYER_ONE =
1
PLAYER_TWO =
2

Class Method Summary collapse

Class Method Details

.index(id) ⇒ Object



14
15
16
# File 'lib/bagel/tennis/player.rb', line 14

def self.index(id)
  id - 1
end

.ONEObject



6
7
8
# File 'lib/bagel/tennis/player.rb', line 6

def self.ONE
  PLAYER_ONE
end

.opponent(id) ⇒ Object



18
19
20
# File 'lib/bagel/tennis/player.rb', line 18

def self.opponent(id)
  id == PLAYER_ONE ? PLAYER_TWO : PLAYER_ONE
end

.TWOObject



10
11
12
# File 'lib/bagel/tennis/player.rb', line 10

def self.TWO
  PLAYER_TWO
end