Class: YARD::Server::Commands::LibraryCommand Abstract
- Defined in:
- lib/yard/server/commands/library_command.rb
Overview
This is the base command for all commands that deal directly with libraries. Some commands do not, but most (like DisplayObjectCommand) do. If your command deals with libraries directly, subclass this class instead. See Base for notes on how to subclass a command.
Direct Known Subclasses
DisplayFileCommand, DisplayObjectCommand, ListCommand, SearchCommand
Basic Command and Adapter Options collapse
-
#adapter ⇒ Adapter
inherited
from Base
The server adapter.
-
#caching ⇒ Boolean
inherited
from Base
Whether to cache.
-
#command_options ⇒ Hash
inherited
from Base
The options passed to the command's constructor.
Attributes Set Per Request collapse
-
#body ⇒ String
inherited
from Base
The response body.
-
#headers ⇒ Hash{String => String}
inherited
from Base
Response headers.
-
#path ⇒ String
inherited
from Base
The path after the command base URI.
-
#request ⇒ Request
inherited
from Base
Request object.
-
#status ⇒ Numeric
inherited
from Base
Status code.
Instance Attribute Summary collapse
-
#incremental ⇒ Boolean
Whether to reparse data.
-
#library ⇒ LibraryVersion
The object containing library information.
-
#options ⇒ LibraryOptions
Default options for the library.
-
#serializer ⇒ Serializers::Base
The serializer used to perform file linking.
-
#single_library ⇒ Boolean
Whether router should route for multiple libraries.
Instance Method Summary collapse
- #call(request) ⇒ Object
-
#initialize(opts = {}) ⇒ LibraryCommand
constructor
A new instance of LibraryCommand.
Constructor Details
#initialize(opts = {}) ⇒ LibraryCommand
Returns a new instance of LibraryCommand
51 52 53 54 |
# File 'lib/yard/server/commands/library_command.rb', line 51 def initialize(opts = {}) super self.serializer = DocServerSerializer.new end |
Instance Attribute Details
#body ⇒ String Originally defined in class Base
Returns the response body. Defaults to empty string.
#caching ⇒ Boolean Originally defined in class Base
Returns whether to cache
#command_options ⇒ Hash Originally defined in class Base
Returns the options passed to the command's constructor
#incremental ⇒ Boolean
Returns whether to reparse data
45 46 47 |
# File 'lib/yard/server/commands/library_command.rb', line 45 def incremental @incremental end |
#library ⇒ LibraryVersion
Returns the object containing library information
33 34 35 |
# File 'lib/yard/server/commands/library_command.rb', line 33 def library @library end |
#options ⇒ LibraryOptions
Returns default options for the library
36 37 38 |
# File 'lib/yard/server/commands/library_command.rb', line 36 def @options end |
#request ⇒ Request Originally defined in class Base
Returns request object
#serializer ⇒ Serializers::Base
Returns the serializer used to perform file linking
39 40 41 |
# File 'lib/yard/server/commands/library_command.rb', line 39 def serializer @serializer end |
#single_library ⇒ Boolean
Returns whether router should route for multiple libraries
42 43 44 |
# File 'lib/yard/server/commands/library_command.rb', line 42 def single_library @single_library end |
#status ⇒ Numeric Originally defined in class Base
Returns status code. Defaults to 200 per request
Instance Method Details
#call(request) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/yard/server/commands/library_command.rb', line 56 def call(request) save_default_template_info self.request = request self. = LibraryOptions.new self..reset_defaults self..command = self setup_library self..title = "Documentation for #{library.name} " + (library.version ? '(' + library.version + ')' : '') super rescue LibraryNotPreparedError not_prepared ensure restore_template_info end |