class Holdem::PokerHand

Attributes

cards[R]
poker_rank[R]

Public Class Methods

new(cards) click to toggle source
# File lib/holdem/poker_hand.rb, line 15
def initialize(cards)
  @cards = cards.is_a?(String) ? CardGenerator.build(cards.split) : cards
  @poker_rank = PokerRank.new(@cards)
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/holdem/poker_hand.rb, line 24
def <=>(other)
  score <=> other.score
end
count() click to toggle source
# File lib/holdem/poker_hand.rb, line 20
def count
  cards.size
end
just_cards() click to toggle source
# File lib/holdem/poker_hand.rb, line 28
def just_cards
  "#{cards.map{ |card| card.to_s }.join(' ')}"
end
to_s() click to toggle source
# File lib/holdem/poker_hand.rb, line 32
def to_s
  "#{just_cards} -> #{rank}"
end