Class: Sashite::Cpn::PiecesInHand

Inherits:
Object
  • Object
show all
Defined in:
lib/sashite/cpn/pieces_in_hand.rb

Overview

Pieces in hand class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*pieces) ⇒ PiecesInHand

Returns a new instance of PiecesInHand.

Parameters:

  • pieces (Array)

    The list of pieces in hand.



8
9
10
# File 'lib/sashite/cpn/pieces_in_hand.rb', line 8

def initialize(*pieces)
  @pieces = pieces.map(&:to_s).sort
end

Instance Attribute Details

#piecesArray (readonly)

Returns The list of pieces in hand.

Returns:

  • (Array)

    The list of pieces in hand.



15
16
17
# File 'lib/sashite/cpn/pieces_in_hand.rb', line 15

def pieces
  @pieces
end

Instance Method Details

#to_sString

Returns A string representation.

Returns:

  • (String)

    A string representation.



18
19
20
# File 'lib/sashite/cpn/pieces_in_hand.rb', line 18

def to_s
  pieces.join(',')
end