Sha256: 753f9105a75ad160e7a6d525f7481c68ae33daf7e3f39b368a8b1cf66f634e00

Contents?: true

Size: 350 Bytes

Versions: 8

Compression:

Stored size: 350 Bytes

Contents

require "enumerator"
class Rack::App::RequestStream
  include Enumerable

  def initialize(io, parser)
    @io = io
    @parser = parser
  end

  def each(&block)
    enum = Enumerator.new do |y|
      # @io.rewind
      while chunk = @io.gets
        y << @parser.call(chunk)
      end
    end

    block_given? ? enum.each(&block) : enum
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rack-app-11.0.2 lib/rack/app/request_stream.rb
rack-app-11.0.1 lib/rack/app/request_stream.rb
rack-app-11.0.0 lib/rack/app/request_stream.rb
rack-app-10.0.0 lib/rack/app/request_stream.rb
rack-app-9.0.0 lib/rack/app/request_stream.rb
rack-app-8.1.0 lib/rack/app/request_stream.rb
rack-app-8.0.1 lib/rack/app/request_stream.rb
rack-app-8.0.0 lib/rack/app/request_stream.rb