class PokerEngine::HandIndex
Constants
- RANK_TABLE
The index is equivalent to the level strength
Attributes
cards[R]
Public Class Methods
new(cards)
click to toggle source
# File lib/poker_engine/hand_index.rb, line 14 def initialize(cards) @cards = cards end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/poker_engine/hand_index.rb, line 18 def <=>(other) outer_level_compare = (RANK_TABLE.index(level) <=> RANK_TABLE.index(other.level)) return outer_level_compare unless outer_level_compare.zero? level <=> other.level end
>(other)
click to toggle source
# File lib/poker_engine/hand_index.rb, line 27 def >(other) level <=> other.level end
level()
click to toggle source
# File lib/poker_engine/hand_index.rb, line 31 def level @level ||= RANK_TABLE.reverse_each.find { |level| level.owns?(cards) } end