Class: AnnRps::Player

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePlayer

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

#choiceObject (readonly)

Returns the value of attribute choice.



6
7
8
# File 'lib/ann_rps.rb', line 6

def choice
  @choice
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/ann_rps.rb', line 6

def name
  @name
end

Instance Method Details

#chooseObject



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