Class: Piece
- Inherits:
-
Object
- Object
- Piece
- Defined in:
- lib/software_challenge_client/piece.rb
Instance Attribute Summary collapse
- #color ⇒ PlayerColor readonly
- #type ⇒ PieceType readonly
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(color, type) ⇒ Piece
constructor
A new instance of Piece.
- #inspect ⇒ Object
- #owner ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(color, type) ⇒ Piece
11 12 13 14 |
# File 'lib/software_challenge_client/piece.rb', line 11 def initialize(color, type) @type = type @color = color end |
Instance Attribute Details
#color ⇒ PlayerColor (readonly)
9 10 11 |
# File 'lib/software_challenge_client/piece.rb', line 9 def color @color end |
#type ⇒ PieceType (readonly)
5 6 7 |
# File 'lib/software_challenge_client/piece.rb', line 5 def type @type end |
Instance Method Details
#==(other) ⇒ Object
16 17 18 |
# File 'lib/software_challenge_client/piece.rb', line 16 def ==(other) type == other.type && color == other.color end |
#inspect ⇒ Object
28 29 30 |
# File 'lib/software_challenge_client/piece.rb', line 28 def inspect to_s end |
#owner ⇒ Object
20 21 22 |
# File 'lib/software_challenge_client/piece.rb', line 20 def owner color end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/software_challenge_client/piece.rb', line 24 def to_s color.value + type.value end |