Class: Sashite::Cpn::PiecesInHand
- Inherits:
-
Object
- Object
- Sashite::Cpn::PiecesInHand
- Defined in:
- lib/sashite/cpn/pieces_in_hand.rb
Overview
Pieces in hand class.
Instance Attribute Summary collapse
-
#pieces ⇒ Array
readonly
The list of pieces in hand.
Instance Method Summary collapse
-
#initialize(*pieces) ⇒ PiecesInHand
constructor
A new instance of PiecesInHand.
-
#to_s ⇒ String
A string representation.
Constructor Details
#initialize(*pieces) ⇒ PiecesInHand
Returns a new instance of PiecesInHand.
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
#pieces ⇒ Array (readonly)
Returns 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_s ⇒ String
Returns A string representation.
18 19 20 |
# File 'lib/sashite/cpn/pieces_in_hand.rb', line 18 def to_s pieces.join(',') end |