I need to do a search comparing two hashs
I use an each to iterate over a hash and b_search to do the binary search:
@player.each do |player|
player_support_search = players_support.bsearch { |player_support| player_support[:score] >= player[:score] }
number_player_support_search [player_support_search [:id]] += 1 unless player_support_search .nil?
end
Is there any pattern where I can refactor to use only one loop?
Aucun commentaire:
Enregistrer un commentaire