123456789_123456789_123456789_123456789_123456789_

Class: YARD::Server::WebrickAdapter

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Adapter
Instance Chain:
self, Adapter
Inherits: YARD::Server::Adapter
Defined in: lib/yard/server/webrick_adapter.rb

Overview

The main adapter to initialize a WEBrick server.

Since:

  • 0.6.0

Class Method Summary

Adapter - Inherited

.new

Creates a new adapter object.

.setup

Performs any global initialization for the adapter.

.shutdown

Performs any global shutdown procedures for the adapter.

Instance Attribute Summary

Instance Method Summary

  • #start

    Initializes a WEBrick server.

Adapter - Inherited

#add_library

Adds a library to the #libraries mapping for a given library object.

#start

Implement this method to connect your adapter to your server.

Constructor Details

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

Instance Method Details

#start

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

Since:

  • 0.6.0

[ GitHub ]

  
# 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