Class: SakuRps::Player

Inherits:
Object
  • Object
show all
Defined in:
lib/saku_rps/player.rb

Direct Known Subclasses

CPUPlayer, HumanPlayer

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#choiceObject

Returns the value of attribute choice.



5
6
7
# File 'lib/saku_rps/player.rb', line 5

def choice
  @choice
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/saku_rps/player.rb', line 4

def name
  @name
end