# Class: YARD::Server::WebrickAdapter

Inherits:
  Adapter
  - Object
  - Adapter
  - YARD::Server::WebrickAdapter
  show all

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

## Overview

The main adapter to initialize a WEBrick server.

Since:

- 0.6.0

## Instance Method Summary collapse

- #start ⇒ Object

  Initializes a WEBrick server.

## Constructor Details

This class inherits a constructor from YARD::Server::Adapter

## Instance Method Details

### #start ⇒ `Object`

Initializes a WEBrick server. If Adapter#server_options contains a `:daemonize` key set to true, the server will be daemonized.

Since:

- 0.6.0

    10
    11
    12
    13
    14
    15
    16

    # File 'lib/yard/server/webrick_adapter.rb', line 10

    def start
      server_options[:ServerType] = WEBrick::Daemon if server_options[:daemonize]
      server = WEBrick::HTTPServer.new(server_options)
      server.mount('/', WebrickServlet, self)
      trap("INT") { server.shutdown }
      server.start
    end