class EulerPoker::OnePair

Public Instance Methods

instance_comparison(other) click to toggle source
# File lib/euler_poker/hands/one_pair.rb, line 5
def instance_comparison(other)
  if pair_rank != other.pair_rank
    pair_rank <=> other.pair_rank
  else
    ranked_extra_cards <=> other.ranked_extra_cards
  end
end
pair_rank() click to toggle source
# File lib/euler_poker/hands/one_pair.rb, line 13
def pair_rank
  rank_counts
    .find { |rank, count| count == 2 }
    .first
end
ranked_extra_cards() click to toggle source
# File lib/euler_poker/hands/one_pair.rb, line 19
def ranked_extra_cards
  descending_ranks.reject { |rank| rank == pair_rank }
end
valid?() click to toggle source
# File lib/euler_poker/hands/one_pair.rb, line 23
def valid?
  one_pair?
end