Class: Player
- Inherits:
-
Object
- Object
- Player
- Defined in:
- lib/software_challenge_client/player.rb
Overview
A player, participating at a game
Instance Attribute Summary collapse
-
#color ⇒ PlayerColor
readonly
The player’s color.
-
#points ⇒ Integer
The player’s points.
Instance Method Summary collapse
- #==(another_player) ⇒ Object
-
#initialize(color) ⇒ Player
constructor
Initializer.
Constructor Details
#initialize(color) ⇒ Player
Initializer
16 17 18 19 |
# File 'lib/software_challenge_client/player.rb', line 16 def initialize(color) @color = color self.points = 0 end |
Instance Attribute Details
#color ⇒ PlayerColor (readonly)
Returns the player’s color.
9 10 11 |
# File 'lib/software_challenge_client/player.rb', line 9 def color @color end |
#points ⇒ Integer
Returns the player’s points.
12 13 14 |
# File 'lib/software_challenge_client/player.rb', line 12 def points @points end |
Instance Method Details
#==(another_player) ⇒ Object
21 22 23 |
# File 'lib/software_challenge_client/player.rb', line 21 def ==(another_player) return self.color == another_player.color end |