1 2 3 4 5 6 7 8 |
#bucket_totals = nodes.reduce(Hash.new() { |h,k| h[k] = 0 }) do |hsh, (node, node_hsh)| # hsh[node_hsh['bucket']] += 1 # hsh #end bucket_totals = Hash.new(0) nodes.values.each do |node| bucket_totals[node['bucket']] += 1 end |
1 2 3 4 5 6 7 8 |
#bucket_totals = nodes.reduce(Hash.new() { |h,k| h[k] = 0 }) do |hsh, (node, node_hsh)| # hsh[node_hsh['bucket']] += 1 # hsh #end bucket_totals = Hash.new(0) nodes.values.each do |node| bucket_totals[node['bucket']] += 1 end |