Sha256: 0cbaaf328b9cc5782a631a412f5d89eb00186bf2589dd6e11b25ab002c4a1dab
Contents?: true
Size: 487 Bytes
Versions: 4
Compression:
Stored size: 487 Bytes
Contents
module Wukong module Streamer # # Emit each unique key and the count of its occurrences # class CountingReducer < Wukong::Streamer::AccumulatingReducer # reset the counter to zero def start! *args @count = 0 end # record one more for this key def accumulate *vals @count += 1 end # emit each key field and the count, tab-separated. def finalize yield [key, @count] end end end end
Version data entries
4 entries across 4 versions & 1 rubygems