Class: LemonadeStand::Player
- Inherits:
-
Object
- Object
- LemonadeStand::Player
- Defined in:
- lib/lemonade_stand/player.rb
Instance Attribute Summary collapse
-
#assets ⇒ Object
Returns the value of attribute assets.
-
#game ⇒ Object
Returns the value of attribute game.
-
#index ⇒ Object
Returns the value of attribute index.
Instance Method Summary collapse
- #choose(choice) ⇒ Object
-
#initialize ⇒ Player
constructor
A new instance of Player.
Constructor Details
#initialize ⇒ Player
Returns a new instance of Player.
8 9 10 |
# File 'lib/lemonade_stand/player.rb', line 8 def initialize @assets = 200 end |
Instance Attribute Details
#assets ⇒ Object
Returns the value of attribute assets.
6 7 8 |
# File 'lib/lemonade_stand/player.rb', line 6 def assets @assets end |
#game ⇒ Object
Returns the value of attribute game.
5 6 7 |
# File 'lib/lemonade_stand/player.rb', line 5 def game @game end |
#index ⇒ Object
Returns the value of attribute index.
4 5 6 |
# File 'lib/lemonade_stand/player.rb', line 4 def index @index end |
Instance Method Details
#choose(choice) ⇒ Object
12 13 14 |
# File 'lib/lemonade_stand/player.rb', line 12 def choose choice game.make_choice choice, { player: self } end |