Class: TresRaya::Board::Row

Inherits:
Object
  • Object
show all
Includes:
SquaresContainer
Defined in:
lib/tres_raya/board.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SquaresContainer

#[], #blanks, #os, #xs

Constructor Details

#initialize(squares, names) ⇒ Row

Returns a new instance of Row.



10
11
12
13
# File 'lib/tres_raya/board.rb', line 10

def initialize( squares, names )
  @squares  = squares
  @names    = names
end

Instance Attribute Details

#namesObject (readonly)

Returns the value of attribute names.



8
9
10
# File 'lib/tres_raya/board.rb', line 8

def names
  @names
end

#squaresObject (readonly)

Returns the value of attribute squares.



8
9
10
# File 'lib/tres_raya/board.rb', line 8

def squares
  @squares
end

Instance Method Details

#==(other) ⇒ Object



21
22
23
# File 'lib/tres_raya/board.rb', line 21

def ==(other)
     (@squares == other.squares) && (@names == other.names)
end

#to_board_name(index) ⇒ Object



17
18
19
# File 'lib/tres_raya/board.rb', line 17

def to_board_name( index ) 
  Board.index_to_name(@names[index]) 
end