class EulerPoker::ThreeOfAKind

Public Instance Methods

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