class YARD::Server::RackAdapter
A server adapter to respond to requests using the Rack server infrastructure.
def call(env)
-
(Array(Numeric,Hash,Array))
- the Rack-style response
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
def print_start_message(server)
def print_start_message(server) opts = server.default_options.merge(server.options) log.puts ">> YARD #{YARD::VERSION} documentation server at http://#{opts[:Host]}:#{opts[:Port]}" # Only happens for Mongrel return unless server.server.to_s == "Rack::Handler::Mongrel" log.puts ">> #{server.server.class_name} web server (running on Rack)" log.puts ">> Listening on #{opts[:Host]}:#{opts[:Port]}, CTRL+C to stop" end
def start
-
(void)
-
def start server = RackServer.new(server_options) server.instance_variable_set("@app", self) print_start_message(server) server.start end