Sha256: d926a13a701f0c5f52f423b5cec5bdf1561464ffe00e103c45997e59e4d71b13

Contents?: true

Size: 269 Bytes

Versions: 13

Compression:

Stored size: 269 Bytes

Contents

require 'set'

module Stages
  class Unique < Stage
    def initialize_loop
      @set = Set.new
      super()
    end

    def die
      @set = Set.new
      super()
    end
    
    def handle_value(value)
      output value if @set.add? value.hash
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
stages-0.3.3 lib/stages/unique.rb
stages-0.3.2 lib/stages/unique.rb
stages-0.3.1 lib/stages/unique.rb
stages-0.3.0 lib/stages/unique.rb
stages-0.2.10 lib/stages/unique.rb
stages-0.2.9 lib/stages/unique.rb
stages-0.2.8 lib/stages/unique.rb
stages-0.2.7 lib/stages/unique.rb
stages-0.2.6 lib/stages/unique.rb
stages-0.2.5 lib/stages/unique.rb
stages-0.2.4 lib/stages/unique.rb
stages-0.2.3 lib/stages/unique.rb
stages-0.2.2 lib/stages/unique.rb