Class: PokerRanking::HandType::StraightFlush

Inherits:
Base
  • Object
show all
Defined in:
lib/hand_type/straight_flush.rb

Constant Summary collapse

SUITS =
%w(Hearts Diamonds Spades Clubs)

Instance Attribute Summary

Attributes inherited from Base

#cards

Instance Method Summary collapse

Methods inherited from Base

#cards_for_values_and_kickers, #cards_in_straight, #highest_same_value, #highest_same_value_except, #initialize, #n_of_a_kind?, #number_of_kickers, #second_value, #straight_value_of

Constructor Details

This class inherits a constructor from PokerRanking::HandType::Base

Instance Method Details

#cards_usedObject



27
28
29
30
31
32
# File 'lib/hand_type/straight_flush.rb', line 27

def cards_used
  SUITS.each do |suit|
    straight_in_suite = cards_in_straight(cards.select { |card| card.suit == suit })
    return straight_in_suite[-5..-1] if straight_in_suite.length >= 5
  end
end

#handles?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/hand_type/straight_flush.rb', line 7

def handles?
  (value > 0)
end

#kickersObject



34
35
36
# File 'lib/hand_type/straight_flush.rb', line 34

def kickers
  []
end

#nameObject



23
24
25
# File 'lib/hand_type/straight_flush.rb', line 23

def name
  'straight flush'
end

#rankObject



11
12
13
# File 'lib/hand_type/straight_flush.rb', line 11

def rank
  8
end

#valueObject



15
16
17
18
19
20
21
# File 'lib/hand_type/straight_flush.rb', line 15

def value
  SUITS.each do |suit|
    value_for_suit = straight_value_of(cards.select { |card| card.suit == suit })
    return value_for_suit if value_for_suit > 0
  end
  0
end