Support for the Ruby 2.1 series ended on March 31 2017. See here for details.

In Files

  • webrick/httpservlet/prochandler.rb

WEBrick::HTTPServlet::ProcHandler

Mounts a proc at a path that accepts a request and response.

Instead of mounting this servlet with WEBrick::HTTPServer#mount use WEBrick::HTTPServer#mount_proc:

server.mount_proc '/' do |req, res|
  res.body = 'it worked!'
  res.status = 200
end