Method: YARD::Server::RackMiddleware#initialize

Defined in:
lib/yard/server/rack_adapter.rb

#initialize(app, opts = {}) ⇒ RackMiddleware

Creates a new Rack-based middleware for serving YARD documentation.

Parameters:

  • app

    the next Rack middleware in the stack

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :libraries (Hash{String=>Array<LibraryVersion>}) — default: {}

    the map of libraries to serve through the adapter. This option is required.

  • :options (Hash) — default: {}

    a list of options to pass to the adapter. See Adapter#options for a list.

  • :server_options (Hash) — default: {}

    a list of options to pass to the server. See Adapter#server_options for a list.

Since:

  • 0.6.0



35
36
37
38
39
# File 'lib/yard/server/rack_adapter.rb', line 35

def initialize(app, opts = {})
  args = [opts[:libraries] || {}, opts[:options] || {}, opts[:server_options] || {}]
  @app = app
  @adapter = RackAdapter.new(*args)
end