Class: OfcpScoring::Straight

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

Direct Known Subclasses

StraightFlush

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



3
4
5
6
# File 'lib/ofcp_scoring/straight.rb', line 3

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

#highest_straight_cardObject



8
9
10
11
12
# File 'lib/ofcp_scoring/straight.rb', line 8

def highest_straight_card
  return ranks.max unless ranks.include?(14)
  return 1 if ranks.include?(14) && ranks.include?(5)
  return 14
end