Sha256: 674d0fb7239ec6820fb5a8bbaa4a130a0e81933aa2bdff018d235e4d927db089
Contents?: true
Size: 747 Bytes
Versions: 1
Compression:
Stored size: 747 Bytes
Contents
class PokerHand include Comparable extend Forwardable def_delegators :@poker_rank, :rank, :score rank_methods = [ :straight_flush?, :quads?, :four_of_a_kind?, :boat?, :full_house?, :flush?, :straight?, :three_of_a_kind?, :trips?, :two_pairs?, :two_pair?, :pair? ] def_delegators :@poker_rank, *rank_methods attr_reader :cards, :poker_rank def initialize(cards) @cards = cards.is_a?(String) ? CardGenerator.build(cards.split) : cards @poker_rank = PokerRank.new(@cards) end def count cards.size end def <=>(other) score <=> other.score end def just_cards "#{cards.map{ |card| card.to_s }.join(' ')}" end def to_s "#{just_cards} -> #{rank}" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
holdem-1.0.0 | lib/holdem/poker_hand.rb |