Class: Rackup::Handler::WEBrick::Input
- Inherits:
-
Object
- Object
- Rackup::Handler::WEBrick::Input
- Includes:
- Stream::Reader
- Defined in:
- lib/rackup/handler/webrick.rb
Overview
This handles mapping the WEBrick request to a Rack input stream.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(request) ⇒ Input
constructor
A new instance of Input.
Methods included from Stream::Reader
#each, #gets, #read, #read_nonblock, #read_partial
Constructor Details
#initialize(request) ⇒ Input
Returns a new instance of Input.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# 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 ⇒ Object
78 79 80 81 |
# File 'lib/rackup/handler/webrick.rb', line 78 def close @request = nil @reader = nil end |