Class: YARD::Server::RackAdapter

Inherits:
Adapter
  • Object
show all
Includes:
WEBrick::HTTPUtils
Defined in:
lib/yard/server/rack_adapter.rb

Overview

Since:

  • 0.6.0

Instance Attribute Summary

Attributes inherited from Adapter

#document_root, #libraries, #options, #router, #server_options

Instance Method Summary collapse

Methods inherited from Adapter

#add_library, #initialize, setup, shutdown

Constructor Details

This class inherits a constructor from YARD::Server::Adapter

Instance Method Details

#call(env) ⇒ Object

Since:

  • 0.6.0



18
19
20
21
22
# File 'lib/yard/server/rack_adapter.rb', line 18

def call(env)
  request = Rack::Request.new(env)
  request.path_info = unescape(request.path_info) # unescape things like %3F
  router.call(request)
end

#startObject

Since:

  • 0.6.0



24
25
26
27
28
29
# File 'lib/yard/server/rack_adapter.rb', line 24

def start
  server = Rack::Server.new(server_options)
  server.instance_variable_set("@app", self)
  print_start_message(server)
  server.start
end