Class: TexasHoldem::PlayerHand
- Inherits:
-
Object
- Object
- TexasHoldem::PlayerHand
- Includes:
- Comparable
- Defined in:
- lib/texas-holdem/player_hand.rb
Instance Attribute Summary collapse
-
#best_combination ⇒ Object
readonly
Returns the value of attribute best_combination.
-
#cards ⇒ Object
readonly
Returns the value of attribute cards.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #add_cards(cards) ⇒ Object
-
#initialize(cards) ⇒ PlayerHand
constructor
A new instance of PlayerHand.
Constructor Details
#initialize(cards) ⇒ PlayerHand
Returns a new instance of PlayerHand.
6 7 8 9 |
# File 'lib/texas-holdem/player_hand.rb', line 6 def initialize(cards) @cards = cards @best_combination = get_best_combination end |
Instance Attribute Details
#best_combination ⇒ Object (readonly)
Returns the value of attribute best_combination.
4 5 6 |
# File 'lib/texas-holdem/player_hand.rb', line 4 def best_combination @best_combination end |
#cards ⇒ Object (readonly)
Returns the value of attribute cards.
4 5 6 |
# File 'lib/texas-holdem/player_hand.rb', line 4 def cards @cards end |
Instance Method Details
#<=>(other) ⇒ Object
16 17 18 |
# File 'lib/texas-holdem/player_hand.rb', line 16 def <=>(other) best_combination <=> other.best_combination end |
#add_cards(cards) ⇒ Object
11 12 13 14 |
# File 'lib/texas-holdem/player_hand.rb', line 11 def add_cards(cards) @cards.push(*cards) @best_combination = get_best_combination end |