Class: YARD::Server::RackAdapter
- Includes:
- WEBrick::HTTPUtils
- Defined in:
- lib/yard/server/rack_adapter.rb
Overview
A server adapter to respond to requests using the Rack server infrastructure.
Instance Method Summary collapse
- 
  
    
      #call(env)  ⇒ Array(Numeric,Hash,Array) 
    
    
  
  
  
  
  
  
  
  
  
    Responds to Rack requests and builds a response with the Router. 
- 
  
    
      #start  ⇒ void 
    
    
  
  
  
  
  
  
  
  
  
    Starts the Rack::Server.
Constructor Details
This class inherits a constructor from YARD::Server::Adapter
Instance Method Details
#call(env) ⇒ Array(Numeric,Hash,Array)
Responds to Rack requests and builds a response with the YARD::Server::Router.
| 49 50 51 52 53 54 55 56 57 | # File 'lib/yard/server/rack_adapter.rb', line 49 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. + "\n" + ex.backtrace.join("\n")]] end | 
#start ⇒ void
This method returns an undefined value.
Starts the Rack::Server. This method will pass control to the server and block.
| 62 63 64 65 66 67 | # File 'lib/yard/server/rack_adapter.rb', line 62 def start server = Rack::Server.new() server.instance_variable_set("@app", self) (server) server.start end |