Module: YARD::Server

Defined in:
lib/yard/autoload.rb,
lib/yard/server.rb,
lib/yard/server/router.rb,
lib/yard/server/adapter.rb,
lib/yard/server/http_utils.rb,
lib/yard/server/rack_adapter.rb,
lib/yard/server/commands/base.rb,
lib/yard/server/static_caching.rb,
lib/yard/server/library_version.rb,
lib/yard/server/webrick_adapter.rb,
lib/yard/server/doc_server_helper.rb,
lib/yard/server/commands/list_command.rb,
lib/yard/server/doc_server_serializer.rb,
lib/yard/server/commands/frames_command.rb,
lib/yard/server/commands/search_command.rb,
lib/yard/server/commands/library_command.rb,
lib/yard/server/commands/static_file_command.rb,
lib/yard/server/commands/static_file_helpers.rb,
lib/yard/server/commands/display_file_command.rb,
lib/yard/server/commands/root_request_command.rb,
lib/yard/server/commands/library_index_command.rb,
lib/yard/server/commands/display_object_command.rb

Overview

Namespace for classes and modules that handle serving documentation over HTTP

Implementing a Custom Server

To customize the YARD server, see the Adapter and Router classes.

Rack Middleware

If you want to use the YARD server as a Rack middleware, see the documentation in RackMiddleware.

Since:

  • 0.6.0

Defined Under Namespace

Modules: Commands, DocServerHelper, HTTPUtils, StaticCaching Classes: Adapter, DocServerSerializer, FinishRequest, LibraryNotPreparedError, LibraryVersion, NotFoundError, RackAdapter, RackMiddleware, Router, WebrickAdapter, WebrickServlet

Constant Summary collapse

CR =

:nodoc:

Since:

  • 0.6.0

"\x0d"
LF =

:nodoc:

Since:

  • 0.6.0

"\x0a"
CRLF =

:nodoc:

Since:

  • 0.6.0

"\x0d\x0a"

Class Method Summary collapse

Class Method Details

.clean_path(path) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Normalizes an HTTP request path into a relative command path.

Parameters:

  • path (String)

    the request path to normalize

Returns:

  • (String)

    a relative path using forward slashes



8
9
10
11
# File 'lib/yard/server.rb', line 8

def self.clean_path(path)
  path = File.cleanpath(path.tr('\\', '/'))
  path.sub(/\A[A-Za-z]:(?!:)/, '').sub(%r{\A/+}, '')
end

.register_static_path(path) ⇒ void

This method returns an undefined value.

Registers a static path to be used in static asset lookup.

Parameters:

  • path (String)

    the pathname to register

Since:

  • 0.6.2



17
18
19
20
# File 'lib/yard/server.rb', line 17

def self.register_static_path(path)
  static_paths = Commands::StaticFileCommand::STATIC_PATHS
  static_paths.push(path) unless static_paths.include?(path)
end