lib/holdem/card.rb in holdem-1.0.0 vs lib/holdem/card.rb in holdem-1.0.1
- old
+ new
@@ -6,11 +6,11 @@
SUITS = %w(c s d h)
ICONS = { 'c' => '♣', 's' => '♠', 'd' => '♦', 'h' => '♥' }
FACE_CARDS = { 'T' => 10, 'J' => 11, 'Q' => 12, 'K' => 13, 'A' => 14 }
def initialize(card)
- @rank, @suit = card.split(//)
- @icon = ICONS[suit]
+ @rank, @suit = card.chars if card.respond_to?(:chars)
+ @icon = ICONS[suit]
validate(card)
end
def value
rank[/\d/] ? rank.to_i : FACE_CARDS[rank]
\ No newline at end of file