Class: TexasHoldem::FourOfAKind

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

Constant Summary collapse

Pattern =
/(\d{1,2})[scdh] (?:\s\1[scdh]){3}/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



58
59
60
# File 'lib/player_hand.rb', line 58

def self.create(cards)
  new cards if cards.match Pattern
end

Instance Method Details

#base_scoreObject



66
67
68
# File 'lib/player_hand.rb', line 66

def base_score
  7
end

#nameObject



62
63
64
# File 'lib/player_hand.rb', line 62

def name
  'four of a kind'
end

#relative_scoreObject



70
71
72
# File 'lib/player_hand.rb', line 70

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