Class: Player
- Inherits:
-
Object
- Object
- Player
- Defined in:
- lib/mblackjack/player.rb
Constant Summary collapse
- @@instance_collector =
[]
Instance Attribute Summary collapse
-
#hand ⇒ Object
Returns the value of attribute hand.
-
#hand_done ⇒ Object
Returns the value of attribute hand_done.
-
#money_left ⇒ Object
Returns the value of attribute money_left.
-
#no_of_hands ⇒ Object
Returns the value of attribute no_of_hands.
-
#player_no ⇒ Object
Returns the value of attribute player_no.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(no_of_hands = 1, money_left) ⇒ Player
constructor
A new instance of Player.
Constructor Details
#initialize(no_of_hands = 1, money_left) ⇒ Player
Returns a new instance of Player.
6 7 8 9 10 11 12 13 |
# File 'lib/mblackjack/player.rb', line 6 def initialize(no_of_hands = 1, money_left) @hand = [] @hand_done = [] @no_of_hands = 0 @player_no = player_no @money_left = money_left @@instance_collector << self end |
Instance Attribute Details
#hand ⇒ Object
Returns the value of attribute hand.
2 3 4 |
# File 'lib/mblackjack/player.rb', line 2 def hand @hand end |
#hand_done ⇒ Object
Returns the value of attribute hand_done.
2 3 4 |
# File 'lib/mblackjack/player.rb', line 2 def hand_done @hand_done end |
#money_left ⇒ Object
Returns the value of attribute money_left.
2 3 4 |
# File 'lib/mblackjack/player.rb', line 2 def money_left @money_left end |
#no_of_hands ⇒ Object
Returns the value of attribute no_of_hands.
2 3 4 |
# File 'lib/mblackjack/player.rb', line 2 def no_of_hands @no_of_hands end |
#player_no ⇒ Object
Returns the value of attribute player_no.
2 3 4 |
# File 'lib/mblackjack/player.rb', line 2 def player_no @player_no end |
Class Method Details
.instance_collector ⇒ Object
15 16 17 |
# File 'lib/mblackjack/player.rb', line 15 def self.instance_collector @@instance_collector end |