Class: PokerHands::FullHouse
- Defined in:
- lib/deck_of_cards_handler/poker_hands/full_house.rb
Constant Summary
Constants inherited from PokerHand
Instance Attribute Summary collapse
-
#pair ⇒ Object
readonly
Returns the value of attribute pair.
-
#three_of_a_kind ⇒ Object
readonly
Returns the value of attribute three_of_a_kind.
Attributes inherited from PokerHand
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(cards:) ⇒ FullHouse
constructor
A new instance of FullHouse.
- #rank ⇒ Object
Methods inherited from PokerHand
Constructor Details
Instance Attribute Details
#pair ⇒ Object (readonly)
Returns the value of attribute pair.
17 18 19 |
# File 'lib/deck_of_cards_handler/poker_hands/full_house.rb', line 17 def pair @pair end |
#three_of_a_kind ⇒ Object (readonly)
Returns the value of attribute three_of_a_kind.
14 15 16 |
# File 'lib/deck_of_cards_handler/poker_hands/full_house.rb', line 14 def three_of_a_kind @three_of_a_kind end |
Class Method Details
.is?(cards) ⇒ Boolean
8 9 10 |
# File 'lib/deck_of_cards_handler/poker_hands/full_house.rb', line 8 def is?(cards) PokerHands::ThreeOfAKind.is?(cards) && PokerHands::OnePair.is?(cards) end |
Instance Method Details
#<=>(other) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/deck_of_cards_handler/poker_hands/full_house.rb', line 32 def <=>(other) return rank <=> other.rank unless instance_of?(other.class) comparison = three_of_a_kind_value <=> other.three_of_a_kind_value return comparison unless comparison.zero? pair_value <=> other.pair_value end |
#rank ⇒ Object
27 28 29 |
# File 'lib/deck_of_cards_handler/poker_hands/full_house.rb', line 27 def rank 7 end |