Class: Blackjack::Turn

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

Constant Summary collapse

HIT =
"h"
VALID_OPTIONS =
['h', 's']

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Turn

Returns a new instance of Turn.



7
8
9
10
11
# File 'lib/blackjack/turn.rb', line 7

def initialize(args)
  @player = args[:player]
  @deck = args[:deck]
  @input
end

Instance Attribute Details

#deckObject

Returns the value of attribute deck.



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

def deck
  @deck
end

#inputObject

Returns the value of attribute input.



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

def input
  @input
end

#playerObject

Returns the value of attribute player.



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

def player
  @player
end

Instance Method Details

#takeObject



13
14
15
16
17
18
19
# File 'lib/blackjack/turn.rb', line 13

def take
  2.times do puts deal_to_player end
  until over?
    puts player.formatted_score
    puts hit_or_stand
  end
end