Permalink
Browse files

Extract code that should be de-duped

  • Loading branch information...
camillebaldock committed Sep 3, 2014
1 parent 7044d07 commit 2159bec521f1c16cfece75e51547e1f15c8f0021
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/hand.rb
View
@@ -39,15 +39,17 @@ def rank
##bob
def pip_count
grouped_cards = cards.map(&:pips).group_by { |i| i }
pips = cards.map(&:pips)
grouped_cards = pips.group_by { |i| i }
grouped_cards.each do |key, value|
grouped_cards[key] = value.count
end
end
##DUPE! pip_count
def suit_count
grouped_cards = cards.map(&:suit).group_by { |i| i }
suits = cards.map(&:suit)
grouped_cards = suits.group_by { |i| i }
grouped_cards.each do |key, value|
grouped_cards[key] = value.count
end

0 comments on commit 2159bec

Please sign in to comment.