Class: TexasHoldem::ThreeOfAKind
Constant Summary
collapse
- Pattern =
/(\d{1,2})[scdh] (?:\s\1[scdh]){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
Class Method Details
.create(cards) ⇒ Object
138
139
140
|
# File 'lib/player_hand.rb', line 138
def self.create(cards)
new(cards) if cards.match Pattern
end
|
Instance Method Details
#base_score ⇒ Object
146
147
148
|
# File 'lib/player_hand.rb', line 146
def base_score
3
end
|
#name ⇒ Object
142
143
144
|
# File 'lib/player_hand.rb', line 142
def name
'three of a kind'
end
|
#relative_score ⇒ Object
150
151
152
|
# File 'lib/player_hand.rb', line 150
def relative_score
@cards[ Pattern, 1 ].to_i
end
|