Class: OfcpScoring::FourOfAKind

Inherits:
RankedHand show all
Defined in:
lib/ofcp_scoring/four_of_a_kind.rb

Constant Summary

Constants inherited from RankedHand

RankedHand::RANKINGS

Instance Method Summary collapse

Methods inherited from RankedHand

#compare_ranks, #grouped_ranks, #initialize, #rank_name, #ranks, #suits

Constructor Details

This class inherits a constructor from OfcpScoring::RankedHand

Instance Method Details

#<=>(other) ⇒ Object



2
3
4
5
# File 'lib/ofcp_scoring/four_of_a_kind.rb', line 2

def <=>(other)
  return super if super
  highest_quad_card <=> other.highest_quad_card
end

#highest_quad_cardObject



7
8
9
# File 'lib/ofcp_scoring/four_of_a_kind.rb', line 7

def highest_quad_card
  grouped_ranks.map{|card,matches| card if matches.size == 4}.compact.max
end