class Card
Constants
- ICONS
- SUITS
- VIEW
Public Class Methods
new(suit, rank)
click to toggle source
# File lib/blackjack/card.rb, line 8 def initialize(suit, rank) @suit = suit @rank = rank @view = self.view() end
Public Instance Methods
rank()
click to toggle source
# File lib/blackjack/card.rb, line 18 def rank @rank end
suit()
click to toggle source
# File lib/blackjack/card.rb, line 14 def suit @suit end
to_s()
click to toggle source
# File lib/blackjack/card.rb, line 38 def to_s() "#{ICONS[@suit]}#{@view}" end
value(ace=:high)
click to toggle source
# File lib/blackjack/card.rb, line 22 def value(ace=:high) val = if @rank == 14 or @rank == 1 ace == :high ? 11 : 1 elsif @rank >= 11 and @rank <= 13 10 else @rank end end
view()
click to toggle source
# File lib/blackjack/card.rb, line 33 def view() view = VIEW[@rank] view ||= @rank end