Sha256: 77ab49a6fa4e6531772fdea10110eabfe58dfe1a38de11f0a9ca56aeafbf9e82
Contents?: true
Size: 561 Bytes
Versions: 3
Compression:
Stored size: 561 Bytes
Contents
# Aggregates the key/value pairs in the results of a ResultSet into a hash # mapping the keys to a hash of each distinct value and how many nodes returned # that value for the key. Puppet::Functions.create_function(:'aggregate::count') do dispatch :aggregate_count do param 'ResultSet', :resultset end def aggregate_count(resultset) resultset.each_with_object({}) do |result, agg| result.value.each do |key, val| agg[key] ||= {} agg[key][val.to_s] ||= 0 agg[key][val.to_s] += 1 end agg end end end
Version data entries
3 entries across 3 versions & 1 rubygems