Class: Rackup::Handler::WEBrick::Input
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
Stream::Reader
|
|
Inherits: | Object |
Defined in: | lib/rackup/handler/webrick.rb |
Overview
This handles mapping the Handler::WEBrick
request to a Rack input stream.
Class Method Summary
- .new(request) ⇒ Input constructor
Instance Method Summary
- #close
-
#read_next
private
Read one chunk from the request body.
Stream::Reader
- Included
#each, #gets, | |
#read | read behaves like |
#read_nonblock, | |
#read_partial | Read at most |
Constructor Details
.new(request) ⇒ Input
# File 'lib/rackup/handler/webrick.rb', line 63
def initialize(request) @request = request @reader = Fiber.new do @request.body do |chunk| Fiber.yield(chunk) end Fiber.yield(nil) # End of stream: @reader = nil end end
Instance Method Details
#close
[ GitHub ]# File 'lib/rackup/handler/webrick.rb', line 78
def close @request = nil @reader = nil end
#read_next (private)
Read one chunk from the request body.
# File 'lib/rackup/handler/webrick.rb', line 86
def read_next @reader&.resume end