Class: SakuRps::Player
- Inherits:
-
Object
- Object
- SakuRps::Player
- Defined in:
- lib/saku_rps/player.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#choice ⇒ Object
Returns the value of attribute choice.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(player_name = nil) ⇒ Player
constructor
A new instance of Player.
Constructor Details
#initialize(player_name = nil) ⇒ Player
Returns a new instance of Player.
7 8 9 10 11 12 13 14 15 |
# File 'lib/saku_rps/player.rb', line 7 def initialize(player_name = nil) @name = if player_name player_name else 'CPU' end @choice = '' end |
Instance Attribute Details
#choice ⇒ Object
Returns the value of attribute choice.
5 6 7 |
# File 'lib/saku_rps/player.rb', line 5 def choice @choice end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/saku_rps/player.rb', line 4 def name @name end |