Class: YARD::Server::Adapter
- Inherits:
-
Object
- Object
- YARD::Server::Adapter
- Defined in:
- lib/yard/server/adapter.rb
Overview
Instance Attribute Summary (collapse)
-
- (String) document_root
The location where static files are located, if any.
-
- (Object) libraries
Returns the value of attribute libraries.
-
- (Object) options
Returns the value of attribute options.
-
- (Object) router
Returns the value of attribute router.
-
- (Object) server_options
Returns the value of attribute server_options.
Class Method Summary (collapse)
Instance Method Summary (collapse)
- - (Object) add_library(library)
-
- (Adapter) initialize(libs, opts = {}, server_opts = {})
constructor
A new instance of Adapter.
- - (Object) start
Constructor Details
- (Adapter) initialize(libs, opts = {}, server_opts = {})
A new instance of Adapter
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. = opts self. = server_opts self.document_root = [:DocumentRoot] self.router = ([:router] || Router).new(self) [:adapter] = self log.debug "Serving libraries using #{self.class}: #{libraries.keys.join(', ')}" log.debug "Caching on" if [: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
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
10 11 12 |
# File 'lib/yard/server/adapter.rb', line 10 def libraries @libraries end |
- (Object) options
Returns the value of attribute options
12 13 14 |
# File 'lib/yard/server/adapter.rb', line 12 def @options end |
- (Object) router
Returns the value of attribute router
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
14 15 16 |
# File 'lib/yard/server/adapter.rb', line 14 def @server_options end |
Class Method Details
+ (Object) setup
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
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)
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
46 47 48 |
# File 'lib/yard/server/adapter.rb', line 46 def start raise NotImplementedError end |