This class wraps the {RackAdapter} into a Rack-compatible middleware. See {initialize} for a list of options to pass via Rack's #use method.
@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.
@example Using the RackMiddleware in a Rack application
libraries = {:mylib => [YARD::Server::LibraryVersion.new('mylib', nil, '/path/to/.yardoc')]} use YARD::Server::RackMiddleware, :libraries => libraries
Creates a new Rack-based middleware for serving YARD documentation.
@param app the next Rack middleware in the stack @option opts [Hash{String=>Array<LibraryVersion>}] :libraries ({})
the map of libraries to serve through the adapter. This option is *required*.
@option opts [Hash] :options ({}) a list of options to pass to the adapter.
See {Adapter#options} for a list.
@option opts [Hash] :server_options ({}) a list of options to pass to the server.
See {Adapter#server_options} for a list.
# File lib/yard/server/rack_adapter.rb, line 26 def initialize(app, opts = {}) args = [opts[:libraries] || {}, opts[:options] || {}, opts[:server_options] || {}] @app = app @adapter = RackAdapter.new(*args) end
Generated with the Darkfish Rdoc Generator 2.