Sha256: 2e2aaccaf0204bedf357289c9d2bd36b1468f93b8a49bd9470f2681ee3253970

Contents?: true

Size: 210 Bytes

Versions: 11

Compression:

Stored size: 210 Bytes

Contents

module Stages
  class Count < Stage    
    def input
      result = Hash.new{ |h, k| h[k] = 0 }
      while v = source.run
        result[v] += 1
      end
      result.empty? ? nil : result
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
stages-0.2.7 lib/stages/count.rb
stages-0.2.6 lib/stages/count.rb
stages-0.2.5 lib/stages/count.rb
stages-0.2.4 lib/stages/count.rb
stages-0.2.3 lib/stages/count.rb
stages-0.2.2 lib/stages/count.rb
stages-0.2.1 lib/stages/count.rb
stages-0.2.0 lib/stages/count.rb
stages-0.1.2 lib/stages/count.rb
stages-0.1.1 lib/stages/count.rb
stages-0.1.0 lib/stages/count.rb