lib/hands/hand_detection.rb in hands-0.1.0 vs lib/hands/hand_detection.rb in hands-0.2.0

- old
+ new

@@ -1,7 +1,7 @@ module Hands - class Hand + module HandDetection # @return [Hash] A hash with `:type` and `:cards` keys. def best_hand response = {} HAND_ORDER.reverse.each do |type| cards = self.send(type.to_sym) @@ -113,10 +113,10 @@ best = self.best_hand return -1 if best.nil? HAND_ORDER.index(best[:type].to_s) end - protected + protected def duplicates pairs = self.cards.collect(&:value) pairs.uniq.select{ |e| (pairs - [e]).size < pairs.size - 1 } end