Class: TexasHoldem::OnePair
Constant Summary
collapse
- Pattern =
/(\d{1,2})[scdh] (?:\s\1[scdh]){1}/x
Instance Attribute Summary
Attributes inherited from PlayerHand
#cards
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from PlayerHand
#<=>, inherited, #initialize, #score
Class Method Details
.create(cards) ⇒ Object
182
183
184
|
# File 'lib/player_hand.rb', line 182
def self.create(cards)
new(cards) if cards.match Pattern
end
|
Instance Method Details
#base_score ⇒ Object
190
191
192
|
# File 'lib/player_hand.rb', line 190
def base_score
1
end
|
#name ⇒ Object
186
187
188
|
# File 'lib/player_hand.rb', line 186
def name
'one pair'
end
|
#relative_score ⇒ Object
194
195
196
|
# File 'lib/player_hand.rb', line 194
def relative_score
@cards[ Pattern , 1 ].to_i * 2
end
|
#remaining_cards ⇒ Object
198
199
200
|
# File 'lib/player_hand.rb', line 198
def remaining_cards
@cards.gsub(Pattern, '').gsub /\D/, ''
end
|