class YARD::Server::RackAdapter

A server adapter to respond to requests using the Rack server infrastructure.

Public Instance Methods

call(env) click to toggle source

Responds to Rack requests and builds a response with the {Router}. @return [Array(Numeric,Hash,Array)] the Rack-style response

# File lib/yard/server/rack_adapter.rb, line 57
def call(env)
  request = Rack::Request.new(env)
  request.path_info = unescape(request.path_info) # unescape things like %3F
  router.call(request)
rescue StandardError => ex
  log.backtrace(ex)
  [500, {'Content-Type' => 'text/plain'},
    [ex.message + "\n" + ex.backtrace.join("\n")]]
end
start() click to toggle source

Starts the Rack server. This method will pass control to the server and block. @return [void]

# File lib/yard/server/rack_adapter.rb, line 70
def start
  server = RackServer.new(server_options)
  server.instance_variable_set("@app", self)
  print_start_message(server)
  server.start
end

Private Instance Methods

print_start_message(server) click to toggle source