Class: TexasHoldem::Straight

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

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



116
117
118
119
120
# File 'lib/player_hand.rb', line 116

def self.create(cards)
  straight = new cards
  card_values = straight.cards.gsub(/[scdh]/,'').split.map {|card_value| card_value.to_i }
  new(cards) if (card_values.first..card_values.last).to_a == card_values
end

Instance Method Details

#base_scoreObject



126
127
128
# File 'lib/player_hand.rb', line 126

def base_score
  4
end

#nameObject



122
123
124
# File 'lib/player_hand.rb', line 122

def name
  'straight'
end

#relative_scoreObject



130
131
132
# File 'lib/player_hand.rb', line 130

def relative_score
  face_values_array.last.to_i
end