Sha256: 8f2c537a8fb231c2078437704fb589aee950c88eade09eb2475b271b6c8e01b0

Contents?: true

Size: 412 Bytes

Versions: 2

Compression:

Stored size: 412 Bytes

Contents

module Wukong
  module Streamer
    #
    # Emit each unique key and the count of its occurrences
    #
    class ListReducer < Wukong::Streamer::AccumulatingReducer
      attr_accessor :values

      # reset the counter to zero
      def start! *args
        self.values = []
      end

      # record one more for this key
      def accumulate *record
        self.values << record
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
mrflip-wukong-0.1.0 lib/wukong/streamer/list_reducer.rb
wukong-0.1.1 lib/wukong/streamer/list_reducer.rb