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
15 16 17 18 |
# File 'lib/software_challenge_client/player.rb', line 15 def initialize(color) @color = color self.points = 0 end |
Instance Attribute Details
#color ⇒ PlayerColor (readonly)
Returns the player’s color.
8 9 10 |
# File 'lib/software_challenge_client/player.rb', line 8 def color @color end |
#points ⇒ Integer
Returns the player’s points.
11 12 13 |
# File 'lib/software_challenge_client/player.rb', line 11 def points @points end |
Instance Method Details
#==(another_player) ⇒ Object
20 21 22 |
# File 'lib/software_challenge_client/player.rb', line 20 def ==(another_player) return self.color == another_player.color end |