Class: LiarsDice::Seat
- Inherits:
-
Object
- Object
- LiarsDice::Seat
- Defined in:
- lib/liars_dice/seat.rb
Instance Attribute Summary collapse
-
#dice ⇒ Object
Returns the value of attribute dice.
-
#dice_left ⇒ Object
readonly
Returns the value of attribute dice_left.
-
#number ⇒ Object
Returns the value of attribute number.
-
#player ⇒ Object
Returns the value of attribute player.
Instance Method Summary collapse
- #alive? ⇒ Boolean
-
#initialize(number, player, starting_dice) ⇒ Seat
constructor
A new instance of Seat.
- #lose_die ⇒ Object
Constructor Details
#initialize(number, player, starting_dice) ⇒ Seat
Returns a new instance of Seat.
6 7 8 9 10 |
# File 'lib/liars_dice/seat.rb', line 6 def initialize(number, player, starting_dice) self.number = number @dice_left = starting_dice self.player = player end |
Instance Attribute Details
#dice ⇒ Object
Returns the value of attribute dice.
4 5 6 |
# File 'lib/liars_dice/seat.rb', line 4 def dice @dice end |
#dice_left ⇒ Object (readonly)
Returns the value of attribute dice_left.
4 5 6 |
# File 'lib/liars_dice/seat.rb', line 4 def dice_left @dice_left end |
#number ⇒ Object
Returns the value of attribute number.
3 4 5 |
# File 'lib/liars_dice/seat.rb', line 3 def number @number end |
#player ⇒ Object
Returns the value of attribute player.
3 4 5 |
# File 'lib/liars_dice/seat.rb', line 3 def player @player end |
Instance Method Details
#alive? ⇒ Boolean
12 13 14 |
# File 'lib/liars_dice/seat.rb', line 12 def alive? dice_left > 0 end |
#lose_die ⇒ Object
21 22 23 |
# File 'lib/liars_dice/seat.rb', line 21 def lose_die @dice_left -= 1 end |