Class: YARD::Server::RackMiddleware
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/yard/server/rack_adapter.rb |
Overview
Note:
You must pass a :libraries
option to the RackMiddleware
via #use
. To
read about how to return a list of libraries, see LibraryVersion
or look
at the example below.
This class wraps the RackAdapter
into a Rack-compatible middleware.
See #initialize
for a list of options to pass via Rack's #use
method.
Class Method Summary
-
.new(app, opts = {}) ⇒ RackMiddleware
constructor
Creates a new Rack-based middleware for serving
::YARD
documentation.
Instance Method Summary
Constructor Details
.new(app, opts = {}) ⇒ RackMiddleware
Creates a new Rack-based middleware for serving ::YARD
documentation.
# File 'lib/yard/server/rack_adapter.rb', line 35
def initialize(app, opts = {}) args = [opts[:libraries] || {}, opts[: ] || {}, opts[: ] || {}] @app = app @adapter = RackAdapter.new(*args) end
Instance Method Details
#call(env)
# File 'lib/yard/server/rack_adapter.rb', line 41
def call(env) status, headers, body = *@adapter.call(env) if status == 404 @app.call(env) else [status, headers, body] end end