class Rack::Builder

Rack::Builder provides a domain-specific language (DSL) to construct Rack applications. It is primarily used to parse config.ru files which instantiate several middleware and a final application which are hosted by a Rack-compatible web server.

Example:

app = Rack::Builder.new do
  use Rack::CommonLogger
  map "/ok" do
    run lambda { |env| [200, {'content-type' => 'text/plain'}, ['OK']] }
  end
end

run app

Or

app = Rack::Builder.app do
  use Rack::CommonLogger
  run lambda { |env| [200, {'content-type' => 'text/plain'}, ['OK']] }
end

run app

use adds middleware to the stack, run dispatches to an application. You can use map to construct a Rack::URLMap in a convenient way.