Class: TexasHoldem::FullHouse

Inherits:
PlayerHand show all
Defined in:
lib/player_hand.rb

Constant Summary collapse

Pattern =
/^(?:(\d) \1{2} (\d) \2|(\d) \3 (\d) \4{2})/x

Instance Attribute Summary

Attributes inherited from PlayerHand

#cards

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PlayerHand

#<=>, inherited, #initialize, #remaining_cards, #score

Constructor Details

This class inherits a constructor from TexasHoldem::PlayerHand

Class Method Details

.create(cards) ⇒ Object



78
79
80
# File 'lib/player_hand.rb', line 78

def self.create(cards)
  new(cards) if cards.gsub(/\D/,'').split(//).sort.to_s.match Pattern
end

Instance Method Details

#base_scoreObject



86
87
88
# File 'lib/player_hand.rb', line 86

def base_score
  6
end

#nameObject



82
83
84
# File 'lib/player_hand.rb', line 82

def name
  'full house'
end

#relative_scoreObject



90
91
92
# File 'lib/player_hand.rb', line 90

def relative_score
  @cards[ TexasHoldem::ThreeOfAKind::Pattern, 1 ].to_i
end