Class: PokerHands::Flush

Inherits:
PokerHand show all
Defined in:
lib/deck_of_cards_handler/poker_hands/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

Constructor Details

This class inherits a constructor from PokerHands::PokerHand

Class Method Details

.is?(cards) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
23
# File 'lib/deck_of_cards_handler/poker_hands/flush.rb', line 20

def is?(cards)
  suit = T.must(cards.first).suit
  cards.all? { _1.suit == suit }
end

Instance Method Details

#<=>(other) ⇒ Object



12
13
14
15
16
# File 'lib/deck_of_cards_handler/poker_hands/flush.rb', line 12

def <=>(other)
  return rank <=> other.rank unless instance_of?(other.class)

  0
end

#rankObject



7
8
9
# File 'lib/deck_of_cards_handler/poker_hands/flush.rb', line 7

def rank
  6
end