Class: Player

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

Constant Summary collapse

@@instance_collector =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#handObject

Returns the value of attribute hand.



2
3
4
# File 'lib/mblackjack/player.rb', line 2

def hand
  @hand
end

#hand_doneObject

Returns the value of attribute hand_done.



2
3
4
# File 'lib/mblackjack/player.rb', line 2

def hand_done
  @hand_done
end

#money_leftObject

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_handsObject

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_noObject

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_collectorObject



15
16
17
# File 'lib/mblackjack/player.rb', line 15

def self.instance_collector
  @@instance_collector
end