Class: Model::Piece
- Inherits:
-
Object
- Object
- Model::Piece
- Defined in:
- lib/tic_tac_toe/model/piece.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#team ⇒ Object
Returns the value of attribute team.
Instance Method Summary collapse
-
#initialize(name, move_klass) ⇒ Piece
constructor
A new instance of Piece.
- #moves(board) ⇒ Object
Constructor Details
#initialize(name, move_klass) ⇒ Piece
Returns a new instance of Piece.
6 7 8 9 |
# File 'lib/tic_tac_toe/model/piece.rb', line 6 def initialize(name, move_klass) @name = name @move_klass = move_klass end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/tic_tac_toe/model/piece.rb', line 3 def name @name end |
#team ⇒ Object
Returns the value of attribute team.
4 5 6 |
# File 'lib/tic_tac_toe/model/piece.rb', line 4 def team @team end |
Instance Method Details
#moves(board) ⇒ Object
11 12 13 |
# File 'lib/tic_tac_toe/model/piece.rb', line 11 def moves(board) @move_klass.generate_moves(self, board) end |