class YARD::Server::Adapter

@abstract
initiate the server backend.
To create a concrete adapter class, implement the {#start} method to
== Subclassing Notes
for other server architectures.
for WEBrick and Rack respectively, though other adapters can be made
backend for a specific server type. YARD implements concrete adapters
This class implements the bridge between the {Router} and the server

def self.setup

Returns:
  • (void) -

Other tags:
    Note: - If you subclass this method, make sure to call +super+.
def self.setup
  Templates::Template.extra_includes |= [YARD::Server::DocServerHelper]
  Templates::Engine.template_paths |= [File.dirname(__FILE__) + '/templates']
end

def self.shutdown

Returns:
  • (void) -

Other tags:
    Note: - If you subclass this method, make sure to call +super+.
def self.shutdown
  Templates::Template.extra_includes -= [YARD::Server::DocServerHelper]
  Templates::Engine.template_paths -= [File.dirname(__FILE__) + '/templates']
end

def add_library(library)

Parameters:
  • library (LibraryVersion) -- a library to add

Other tags:
    Example: Adding a new library to an adapter -
def add_library(library)
  libraries[library.name] ||= []
  libraries[library.name] |= [library]
end

def initialize(libs, opts = {}, server_opts = {})

Options Hash: (**opts)
  • :single_library (Boolean) -- whether to server documentation
  • :caching (Boolean) -- whether or not caching is enabled
  • :router (Class) -- the router class to initialize as the

Parameters:
  • opts (Hash) -- extra options to pass to the adapter
  • libs (Hash{String=>Array}) -- a list of libraries,
def initialize(libs, opts = {}, server_opts = {})
  self.class.setup
  self.libraries = libs
  self.options = opts
  self.server_options = server_opts
  self.document_root = server_options[:DocumentRoot]
  self.router = (options[:router] || Router).new(self)
  options[:adapter] = self
  log.debug "Serving libraries using #{self.class}: #{libraries.keys.join(', ')}"
  log.debug "Caching on" if options[:caching]
  log.debug "Document root: #{document_root}" if document_root
end

def start

Other tags:
    Abstract: -
def start
  raise NotImplementedError
end