Class: Model::Tile

Inherits:
Object
  • Object
show all
Defined in:
lib/tic_tac_toe/model/tile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#colObject

Returns the value of attribute col.



3
4
5
# File 'lib/tic_tac_toe/model/tile.rb', line 3

def col
  @col
end

#pieceObject

Returns the value of attribute piece.



3
4
5
# File 'lib/tic_tac_toe/model/tile.rb', line 3

def piece
  @piece
end

#rowObject

Returns the value of attribute row.



3
4
5
# File 'lib/tic_tac_toe/model/tile.rb', line 3

def row
  @row
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/tic_tac_toe/model/tile.rb', line 5

def available?
  piece.nil?
end

#piece_nameObject



13
14
15
# File 'lib/tic_tac_toe/model/tile.rb', line 13

def piece_name
  piece ? piece.name : '-'
end

#teamObject



9
10
11
# File 'lib/tic_tac_toe/model/tile.rb', line 9

def team
  piece&.team
end