Class: PokerHands::StraightFlush
- Inherits:
-
PokerHand
show all
- Defined in:
- lib/deck_of_cards_handler/poker_hands/straight_flush.rb
Constant Summary
Constants inherited
from PokerHand
PokerHand::HANDS
Instance Attribute Summary
Attributes inherited from PokerHand
#cards
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from PokerHand
build_from_string, create, #initialize
Class Method Details
.is?(cards) ⇒ Boolean
8
9
10
|
# File 'lib/deck_of_cards_handler/poker_hands/straight_flush.rb', line 8
def is?(cards)
Flush.is?(cards) && Straight.is?(cards)
end
|
Instance Method Details
#<=>(other) ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/deck_of_cards_handler/poker_hands/straight_flush.rb', line 19
def <=>(other)
return rank <=> other.rank unless instance_of?(other.class)
c1 = cards.map { card_value(_1) }
c2 = other.cards.map { other.card_value(_1) }
c1 <=> c2
end
|
#rank ⇒ Object
14
15
16
|
# File 'lib/deck_of_cards_handler/poker_hands/straight_flush.rb', line 14
def rank
9
end
|