Class: PlayerSymbols

Inherits:
Object
  • Object
show all
Defined in:
lib/player_symbols.rb

Constant Summary collapse

X =
:X
O =
:O

Class Method Summary collapse

Class Method Details

.allObject



9
10
11
# File 'lib/player_symbols.rb', line 9

def self.all
  [X.to_s, O.to_s]
end

.opponent(symbol) ⇒ Object



5
6
7
# File 'lib/player_symbols.rb', line 5

def self.opponent(symbol)
  symbol == X ? O : X
end

.to_symbol(value) ⇒ Object



13
14
15
# File 'lib/player_symbols.rb', line 13

def self.to_symbol(value)
  value == X.to_s ? X : O
end