class OfcpScoring::TwoPair

Public Instance Methods

<=>(other) click to toggle source
Calls superclass method OfcpScoring::RankedHand#<=>
# File lib/ofcp_scoring/two_pair.rb, line 2
def <=>(other)
  return super if super
  if higher_paired_card == other.higher_paired_card
    if lower_paired_card == other.lower_paired_card
      compare_ranks(other)
    else
      lower_paired_card <=> other.lower_paired_card
    end
  else
    higher_paired_card <=> other.higher_paired_card
  end
end
higher_paired_card() click to toggle source
# File lib/ofcp_scoring/two_pair.rb, line 15
def higher_paired_card
  grouped_ranks.map{|card,matches| card if matches.size == 2}.compact.max
end
lower_paired_card() click to toggle source
# File lib/ofcp_scoring/two_pair.rb, line 19
def lower_paired_card
  grouped_ranks.map{|card,matches| card if matches.size == 2}.compact.min
end