Class: AnnRps::Player
- Inherits:
-
Object
- Object
- AnnRps::Player
- Defined in:
- lib/ann_rps.rb
Instance Attribute Summary collapse
-
#choice ⇒ Object
readonly
Returns the value of attribute choice.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #choose ⇒ Object
-
#initialize ⇒ Player
constructor
A new instance of Player.
Constructor Details
#initialize ⇒ Player
Returns a new instance of Player.
7 8 9 10 |
# File 'lib/ann_rps.rb', line 7 def initialize puts "What is your name?" @name = gets.chomp end |
Instance Attribute Details
#choice ⇒ Object (readonly)
Returns the value of attribute choice.
6 7 8 |
# File 'lib/ann_rps.rb', line 6 def choice @choice end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/ann_rps.rb', line 6 def name @name end |
Instance Method Details
#choose ⇒ Object
12 13 14 15 |
# File 'lib/ann_rps.rb', line 12 def choose puts "Do you choose rock, paper, or scissors? (Enter: r, p or s)" @choice = gets.chomp end |