Class: Matchup
- Inherits:
-
Object
- Object
- Matchup
- Defined in:
- lib/rpoker/matchup.rb
Instance Attribute Summary collapse
-
#hand1 ⇒ Object
readonly
Returns the value of attribute hand1.
-
#hand2 ⇒ Object
readonly
Returns the value of attribute hand2.
Instance Method Summary collapse
-
#initialize(hand1, hand2) ⇒ Matchup
constructor
A new instance of Matchup.
- #winner ⇒ Object
Constructor Details
#initialize(hand1, hand2) ⇒ Matchup
Returns a new instance of Matchup.
3 4 5 |
# File 'lib/rpoker/matchup.rb', line 3 def initialize(hand1, hand2) @hand1, @hand2 = hand1, hand2 end |
Instance Attribute Details
#hand1 ⇒ Object (readonly)
Returns the value of attribute hand1.
2 3 4 |
# File 'lib/rpoker/matchup.rb', line 2 def hand1 @hand1 end |
#hand2 ⇒ Object (readonly)
Returns the value of attribute hand2.
2 3 4 |
# File 'lib/rpoker/matchup.rb', line 2 def hand2 @hand2 end |
Instance Method Details
#winner ⇒ Object
7 8 9 10 11 |
# File 'lib/rpoker/matchup.rb', line 7 def winner return hand1 if hand1.rank_idx < hand2.rank_idx return hand2 if hand2.rank_idx < hand1.rank_idx same_rank_winner end |