class JustBackgammon::Piece
Piece
¶ ↑
A piece owned by a player that moves around the board.
Attributes
id[R]
@return [Fixnum] the identifier of the piece.
player_number[R]
@return [Fixnum] the owner of the piece
Public Class Methods
new(id: , player_number:)
click to toggle source
A new instance of Piece
.
@param [Fixnum] id
The identifier of the piece.
@param [Fixnum] player_number
The owner of the piece.
Example:¶ ↑
# Instantiates a new Piece JustBackgammon::Piece.new(id: 1, player_number: 1)
# File lib/just_backgammon/piece.rb, line 22 def initialize(id: , player_number:) @id = id @player_number = player_number end
Public Instance Methods
as_json()
click to toggle source
A hashed serialized representation of the piece.
@return [Hash]
# File lib/just_backgammon/piece.rb, line 36 def as_json { id: id, player_number: player_number } end