Class: TexasHoldem::Flush

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

Constant Summary collapse

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



98
99
100
# File 'lib/player_hand.rb', line 98

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

Instance Method Details

#base_scoreObject



106
107
108
# File 'lib/player_hand.rb', line 106

def base_score
  5
end

#nameObject



102
103
104
# File 'lib/player_hand.rb', line 102

def name
  'flush'
end

#relative_scoreObject



110
111
112
# File 'lib/player_hand.rb', line 110

def relative_score
  face_values_array.sort.last.to_i
end