Class: YARD::Server::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/yard/server/adapter.rb

Overview

Since:

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Adapter) initialize(libs, opts = {}, server_opts = {})

A new instance of Adapter

Since:

  • 0.6.0



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/yard/server/adapter.rb', line 28

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

Instance Attribute Details

- (String) document_root

The location where static files are located, if any

Returns:

  • (String)

    the location where static files are located, if any

Since:

  • 0.6.0



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

def document_root
  @document_root
end

- (Object) libraries

Returns the value of attribute libraries

Since:

  • 0.6.0



10
11
12
# File 'lib/yard/server/adapter.rb', line 10

def libraries
  @libraries
end

- (Object) options

Returns the value of attribute options

Since:

  • 0.6.0



12
13
14
# File 'lib/yard/server/adapter.rb', line 12

def options
  @options
end

- (Object) router

Returns the value of attribute router

Since:

  • 0.6.0



16
17
18
# File 'lib/yard/server/adapter.rb', line 16

def router
  @router
end

- (Object) server_options

Returns the value of attribute server_options

Since:

  • 0.6.0



14
15
16
# File 'lib/yard/server/adapter.rb', line 14

def server_options
  @server_options
end

Class Method Details

+ (Object) setup

Since:

  • 0.6.0



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

def self.setup
  Templates::Template.extra_includes |= [YARD::Server::DocServerHelper]
  Templates::Engine.template_paths |= [File.dirname(__FILE__) + '/templates']
end

+ (Object) shutdown

Since:

  • 0.6.0



23
24
25
26
# File 'lib/yard/server/adapter.rb', line 23

def self.shutdown
  Templates::Template.extra_includes -= [YARD::Server::DocServerHelper]
  Templates::Engine.template_paths -= [File.dirname(__FILE__) + '/templates']
end

Instance Method Details

- (Object) add_library(library)

Since:

  • 0.6.0



41
42
43
44
# File 'lib/yard/server/adapter.rb', line 41

def add_library(library)
  libraries[library.name] ||= []
  libraries[library.name] |= [library]
end

- (Object) start

Raises:

  • (NotImplementedError)

Since:

  • 0.6.0



46
47
48
# File 'lib/yard/server/adapter.rb', line 46

def start
  raise NotImplementedError
end