Sha256: b2a5c045dc8be89f99eb769a42f3f51204bad6908a6d4b1a3714b1f683ee73f9

Contents?: true

Size: 304 Bytes

Versions: 5

Compression:

Stored size: 304 Bytes

Contents

module Stages
  class Limit < Stage
    def initialize(allowed)
      @allowed = allowed
      @sent = 0
      super()
    end

    def process
      while @sent < @allowed
        handle_value input
        @sent += 1
      end
    end

     def reset
       @sent = 0
       super()
     end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
stages-1.2.1 lib/stages/limit.rb
stages-1.2.0 lib/stages/limit.rb
stages-1.1.5 lib/stages/limit.rb
stages-1.1.2 lib/stages/limit.rb
stages-1.1.1 lib/stages/limit.rb