Sha256: 9acac992fd67a044441c8ef7e1d6ba9b79dba8622f53c5b330d0bd03fcaeb484
Contents?: true
Size: 594 Bytes
Versions: 96
Compression:
Stored size: 594 Bytes
Contents
# frozen_string_literal: true # 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 targets 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
96 entries across 96 versions & 1 rubygems