class PokerEngine::HandLevels::BaseLevel

Abstract class for Hand level

Attributes

cards[R]

Public Class Methods

new(cards) click to toggle source
# File lib/poker_engine/hand_levels.rb, line 9
def initialize(cards)
  @cards = cards
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/poker_engine/hand_levels.rb, line 13
def <=>(other)
  unless other.instance_of?(self.class)
    fail "Can't detail compare hands of different level"
  end

  detail_compare(other)
end
detail_compare(other) click to toggle source
# File lib/poker_engine/hand_levels.rb, line 21
def detail_compare(other)
  cards.values_desc_by_occurency <=>
    other.cards.values_desc_by_occurency
end