Module: PlayerHandDraw
- Included in:
- PlayerHand
- Defined in:
- lib/blackjack/player_hand_draw.rb
Instance Method Summary collapse
Instance Method Details
#draw(index) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/blackjack/player_hand_draw.rb', line 4 def draw(index) out = String.new(' ') out << draw_cards out << draw_money(index) out << draw_status out << "\n\n" out end |
#draw_cards ⇒ Object
36 37 38 39 40 41 |
# File 'lib/blackjack/player_hand_draw.rb', line 36 def draw_cards out = String.new('') out << cards.map { |card| "#{card} " }.join out << ' ⇒ ' << value(:soft).to_s << ' ' out end |
#draw_money(index) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/blackjack/player_hand_draw.rb', line 26 def draw_money(index) out = String.new('') out << '-' if status == :lost out << '+' if status == :won out << '$' << Format.money(bet / 100.0) out << ' ⇐' if !played && index == blackjack.current_hand out << ' ' out end |
#draw_status ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/blackjack/player_hand_draw.rb', line 13 def draw_status case status when :lost busted? ? 'Busted!' : 'Lose!' when :won blackjack? ? 'Blackjack!' : 'Won!' when :push 'Push' else '' end end |