yard 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of yard might be problematic. Click here for more details.

Files changed (46) hide show
  1. data/ChangeLog +119 -0
  2. data/README.md +16 -2
  3. data/Rakefile +29 -10
  4. data/docs/GettingStarted.md +186 -35
  5. data/lib/yard.rb +1 -1
  6. data/lib/yard/autoload.rb +10 -0
  7. data/lib/yard/cli/yri.rb +2 -2
  8. data/lib/yard/code_objects/base.rb +1 -1
  9. data/lib/yard/code_objects/method_object.rb +2 -1
  10. data/lib/yard/code_objects/root_object.rb +2 -2
  11. data/lib/yard/parser/ruby/ast_node.rb +0 -4
  12. data/lib/yard/parser/ruby/ruby_parser.rb +30 -1
  13. data/lib/yard/server/adapter.rb +50 -1
  14. data/lib/yard/server/commands/base.rb +117 -23
  15. data/lib/yard/server/commands/display_file_command.rb +3 -0
  16. data/lib/yard/server/commands/display_object_command.rb +1 -0
  17. data/lib/yard/server/commands/frames_command.rb +1 -0
  18. data/lib/yard/server/commands/library_command.rb +8 -1
  19. data/lib/yard/server/commands/list_command.rb +4 -0
  20. data/lib/yard/server/doc_server_helper.rb +15 -0
  21. data/lib/yard/server/doc_server_serializer.rb +2 -0
  22. data/lib/yard/server/library_version.rb +141 -0
  23. data/lib/yard/server/rack_adapter.rb +35 -2
  24. data/lib/yard/server/router.rb +71 -1
  25. data/lib/yard/server/static_caching.rb +29 -0
  26. data/lib/yard/server/webrick_adapter.rb +4 -0
  27. data/lib/yard/templates/engine.rb +1 -1
  28. data/lib/yard/templates/helpers/markup_helper.rb +22 -7
  29. data/spec/cli/diff_spec.rb +2 -2
  30. data/spec/cli/stats_spec.rb +1 -1
  31. data/spec/cli/yardoc_spec.rb +1 -1
  32. data/spec/cli/yri_spec.rb +21 -0
  33. data/spec/handlers/class_handler_spec.rb +1 -0
  34. data/spec/handlers/examples/class_handler_001.rb.txt +1 -0
  35. data/spec/parser/ruby/legacy/statement_list_spec.rb +6 -0
  36. data/spec/parser/ruby/ruby_parser_spec.rb +29 -0
  37. data/spec/server/rack_adapter_spec.rb +18 -0
  38. data/spec/spec_helper.rb +6 -2
  39. data/spec/templates/engine_spec.rb +4 -1
  40. data/spec/templates/helpers/html_helper_spec.rb +11 -0
  41. data/spec/templates/helpers/markup_helper_spec.rb +9 -5
  42. data/spec/templates/module_spec.rb +1 -1
  43. data/spec/templates/spec_helper.rb +3 -3
  44. data/templates/default/fulldoc/html/css/style.css +1 -1
  45. data/templates/default/fulldoc/html/js/app.js +3 -2
  46. metadata +7 -15
@@ -1,6 +1,7 @@
1
1
  module YARD
2
2
  module Server
3
3
  module Commands
4
+ # Displays documentation for a specific object identiied by the path
4
5
  class DisplayObjectCommand < LibraryCommand
5
6
  def run
6
7
  return index if path.empty?
@@ -1,6 +1,7 @@
1
1
  module YARD
2
2
  module Server
3
3
  module Commands
4
+ # Displays an object wrapped in frames
4
5
  class FramesCommand < DisplayObjectCommand
5
6
  include DocServerHelper
6
7
 
@@ -1,6 +1,12 @@
1
1
  module YARD
2
2
  module Server
3
3
  module Commands
4
+ # This is the base command for all commands that deal directly with libraries.
5
+ # Some commands do not, but most (like {DisplayObjectCommand}) do. If your
6
+ # command deals with libraries directly, subclass this class instead.
7
+ # See {Base} for notes on how to subclass a command.
8
+ #
9
+ # @abstract
4
10
  class LibraryCommand < Base
5
11
  # @return [LibraryVersion] the object containing library information
6
12
  attr_accessor :library
@@ -42,7 +48,7 @@ module YARD
42
48
  rescue LibraryNotPreparedError
43
49
  not_prepared
44
50
  end
45
-
51
+
46
52
  private
47
53
 
48
54
  def setup_library
@@ -85,6 +91,7 @@ module YARD
85
91
  [302, {'Content-Type' => 'text/html'}, [render]]
86
92
  end
87
93
 
94
+ # @private
88
95
  @@last_yardoc = nil
89
96
  end
90
97
  end
@@ -1,6 +1,7 @@
1
1
  module YARD
2
2
  module Server
3
3
  module Commands
4
+ # Returns a list of objects of a specific type
4
5
  class ListCommand < LibraryCommand
5
6
  include Templates::Helpers::BaseHelper
6
7
 
@@ -14,6 +15,7 @@ module YARD
14
15
  end
15
16
  end
16
17
 
18
+ # Returns the list of classes / modules in a library
17
19
  class ListClassesCommand < ListCommand
18
20
  def type; :class end
19
21
 
@@ -23,6 +25,7 @@ module YARD
23
25
  end
24
26
  end
25
27
 
28
+ # Returns the list of methods in a library
26
29
  class ListMethodsCommand < ListCommand
27
30
  include Templates::Helpers::ModuleHelper
28
31
 
@@ -35,6 +38,7 @@ module YARD
35
38
  end
36
39
  end
37
40
 
41
+ # Returns the list of README/extra files in a library
38
42
  class ListFilesCommand < ListCommand
39
43
  def type; :files end
40
44
  def items; options[:files] end
@@ -1,21 +1,36 @@
1
1
  module YARD
2
2
  module Server
3
+ # A module that is mixed into {Templates::Template} in order to customize
4
+ # certain template methods.
3
5
  module DocServerHelper
6
+ # Modifies {Templates::Helpers::HtmlHelper#url_for} to return a URL instead
7
+ # of a disk location.
8
+ # @param (see Templates::Helpers::HtmlHelper#url_for)
9
+ # @return (see Templates::Helpers::HtmlHelper#url_for)
4
10
  def url_for(obj, anchor = nil, relative = false)
5
11
  return '' if obj.nil?
6
12
  return "/#{obj}" if String === obj
7
13
  super(obj, anchor, false)
8
14
  end
9
15
 
16
+ # Modifies {Templates::Helpers::HtmlHelper#url_for_file} to return a URL instead
17
+ # of a disk location.
18
+ # @param (see Templates::Helpers::HtmlHelper#url_for_file)
19
+ # @return (see Templates::Helpers::HtmlHelper#url_for_file)
10
20
  def url_for_file(filename, anchor = nil)
11
21
  "/#{base_path(router.docs_prefix)}/file/" + filename.sub(%r{^#{@library.source_path.to_s}/}, '') +
12
22
  (anchor ? "##{anchor}" : "")
13
23
  end
14
24
 
25
+ # @example The base path for a library 'foo'
26
+ # base_path('docs') # => 'docs/foo'
27
+ # @param [String] path the path prefix for a base path URI
28
+ # @return [String] the base URI for a library with an extra +path+ prefix
15
29
  def base_path(path)
16
30
  path + (@single_library ? '' : "/#{@library}")
17
31
  end
18
32
 
33
+ # @return [Router] convenience method for accessing the router
19
34
  def router; @adapter.router end
20
35
  end
21
36
  end
@@ -2,6 +2,8 @@ require 'webrick/httputils'
2
2
 
3
3
  module YARD
4
4
  module Server
5
+ # A custom {Serializers::Base serializer} which returns resource URLs instead of
6
+ # static relative paths to files on disk.
5
7
  class DocServerSerializer < Serializers::FileSystemSerializer
6
8
  include WEBrick::HTTPUtils
7
9
 
@@ -2,15 +2,121 @@ require 'fileutils'
2
2
 
3
3
  module YARD
4
4
  module Server
5
+ # This exception is raised when {LibraryVersion#prepare!} fails, or discovers
6
+ # that the library is not "prepared" to be served by
5
7
  class LibraryNotPreparedError < RuntimeError; end
6
8
 
9
+ # A library version encapsulates a library's documentation at a specific version.
10
+ # Although the version is optional, this allows for creating multiple documentation
11
+ # points for a specific library, each representing a unique version. The term
12
+ # "library" used in other parts of the YARD::Server documentation refers to
13
+ # objects of this class unless otherwise noted.
14
+ #
15
+ # A library points to a location where a {#yardoc_file} is located so that
16
+ # its documentation may be loaded and served. Optionally, a {#source_path} is
17
+ # given to point to a location where any extra files (and {YARD::CLI::Yardoc .yardopts})
18
+ # should be loaded from. Both of these methods may not be known immediately,
19
+ # since the yardoc file may not be built until later. Resolving the yardoc
20
+ # file and source path are dependent on the specific library "source type" used.
21
+ # Source types (known as "library source") are discussed in detail below.
22
+ #
23
+ # == Using with Adapters
24
+ # A list of libraries need to be passed into adapters upon creation. In
25
+ # most cases, you will never do this manually, but if you use a {RackMiddleware},
26
+ # you will need to pass in this list yourself. To build this list of libraries,
27
+ # you should create a hash of library names mapped to an *Array* of LibraryVersion
28
+ # objects. For example:
29
+ #
30
+ # {'mylib' => [LibraryVersion.new('mylib', '1.0', ...),
31
+ # LibraryVersion.new('mylib', '2.0', ...)]}
32
+ #
33
+ # Note that you can also use {Adapter#add_library} for convenience.
34
+ #
35
+ # The "array" part is required, even for just one library version.
36
+ #
37
+ # == Library Sources
38
+ # The {#source} method represents the library source type, ie. where the
39
+ # library "comes from". It might come from "disk", or it might come from a
40
+ # "gem" (technically the disk, but a separate type nonetheless). In these
41
+ # two cases, the yardoc file sits somewhere on your filesystem, though
42
+ # it may also be built dynamically if it does not yet exist. This behaviour
43
+ # is controlled through the {#prepare!} method, which prepares the yardoc file
44
+ # given a specific library source. We will see how this works in detail in
45
+ # the following section.
46
+ #
47
+ # == Implementing a Custom Library Source
48
+ # YARD can be extended to support custom library sources in order to
49
+ # build or retrieve a yardoc file at runtime from many different locations.
50
+ #
51
+ # To implement this behaviour, two methods must be added to the +LibraryVersion+
52
+ # class, +#load_yardoc_from_SOURCE+ and +#source_path_for_SOURCE+. In both
53
+ # cases, "SOURCE" represents the source type used in {#source} when creating
54
+ # the library object. The +#source_path_for_SOURCE+ method is called upon
55
+ # creation and should return the location where the source code for the library
56
+ # lives. The load method is called from {#prepare!} if there is no yardoc file
57
+ # and should set {#yardoc_file}. Below is a full example for
58
+ # implementing a custom library source, +:http+, which reads packaged .yardoc
59
+ # databases from zipped archives off of an HTTP server.
60
+ #
61
+ # @example Implementing a Custom Library Source
62
+ # # Adds the source type "http" for .yardoc files zipped on HTTP servers
63
+ # class LibraryVersion
64
+ # def load_yardoc_from_http
65
+ # return if yardoc_file # we have the library
66
+ #
67
+ # # otherwise download it in a thread and return immediately
68
+ # Thread.new do
69
+ # # zip/unzip method implementations are not shown
70
+ # download_zip_file("http://mysite.com/yardocs/#{self}.zip")
71
+ # unzip_file_to("/path/to/yardocs/#{self}")
72
+ # self.yardoc_file = "/path/to/yardocs/#{self}/.yardoc"
73
+ # self.source_path = self.yardoc_file
74
+ # end
75
+ #
76
+ # # tell the server it's not ready yet (but it might be next time)
77
+ # raise LibraryNotPreparedError
78
+ # end
79
+ #
80
+ # # we set this later
81
+ # def source_path_for_http; nil end
82
+ # end
83
+ #
84
+ # # Creating a library of this source type:
85
+ # LibraryVersion.new('name', '1.0', nil, :http)
86
+ #
7
87
  class LibraryVersion
88
+ # @return [String] the name of the library
8
89
  attr_accessor :name
90
+
91
+ # @return [String] the version of the specific library
9
92
  attr_accessor :version
93
+
94
+ # @return [String] the location of the yardoc file used to load the object
95
+ # information from.
96
+ # @return [nil] if no yardoc file exists yet. In this case, {#prepare!} will
97
+ # be called on this library to build the yardoc file.
10
98
  attr_accessor :yardoc_file
99
+
100
+ # @return [Symbol] the source type representing where the yardoc should be
101
+ # loaded from. Defaults are +:disk+ and +:gem+, though custom sources
102
+ # may be implemented. This value is used to inform {#prepare!} about how
103
+ # to load the necessary data in order to display documentation for an object.
104
+ # @see LibraryVersion LibraryVersion documentation for "Implementing a Custom Library Source"
11
105
  attr_accessor :source
106
+
107
+ # @return [String] the location of the source code for a library. This
108
+ # value is filled by calling +#source_path_for_SOURCE+ on this class.
109
+ # @return [nil] if there is no source code
110
+ # @see LibraryVersion LibraryVersion documentation for "Implementing a Custom Library Source"
12
111
  attr_accessor :source_path
13
112
 
113
+ # @param [String] name the name of the library
114
+ # @param [String] version the specific (usually, but not always, numeric) library
115
+ # version
116
+ # @param [String] yardoc the location of the yardoc file, or nil if it is
117
+ # generated later
118
+ # @param [Symbol] source the location of the files used to build the yardoc.
119
+ # Builtin source types are +:disk+ or +:gem+.
14
120
  def initialize(name, version = nil, yardoc = nil, source = :disk)
15
121
  self.name = name
16
122
  self.yardoc_file = yardoc
@@ -19,12 +125,18 @@ module YARD
19
125
  self.source_path = load_source_path
20
126
  end
21
127
 
128
+ # @param [Boolean] url_format if true, returns the string in a URI-compatible
129
+ # format (for appending to a URL). Otherwise, it is given in a more human
130
+ # readable format.
131
+ # @return [String] the string representation of the library.
22
132
  def to_s(url_format = true)
23
133
  version ? "#{name}#{url_format ? '/' : '-'}#{version}" : "#{name}"
24
134
  end
25
135
 
136
+ # @return [Fixnum] used for Hash mapping.
26
137
  def hash; to_s.hash end
27
138
 
139
+ # @return [Boolean] whether another LibraryVersion is equal to this one
28
140
  def eql?(other)
29
141
  other.is_a?(LibraryVersion) && other.name == name &&
30
142
  other.version == version && other.yardoc_file == yardoc_file
@@ -32,12 +144,30 @@ module YARD
32
144
  alias == eql?
33
145
  alias equal? eql?
34
146
 
147
+ # @note You should not directly override this method. Instead, implement
148
+ # +load_yardoc_from_SOURCENAME+ when implementing loading for a specific
149
+ # source type. See the {LibraryVersion} documentation for "Implementing
150
+ # a Custom Library Source"
151
+ #
152
+ # Prepares a library to be displayed by the server. This callback is
153
+ # performed before each request on a library to ensure that it is loaded
154
+ # and ready to be viewed. If any steps need to be performed prior to loading,
155
+ # they are performed through this method (though they should be implemented
156
+ # through the +load_yardoc_from_SOURCE+ method).
157
+ #
158
+ # @raise [LibraryNotPreparedError] if the library is not ready to be
159
+ # displayed. Usually when raising this error, you would simultaneously
160
+ # begin preparing the library for subsequent requests, although this
161
+ # is not necessary.
35
162
  def prepare!
36
163
  return if yardoc_file
37
164
  meth = "load_yardoc_from_#{source}"
38
165
  send(meth) if respond_to?(meth)
39
166
  end
40
167
 
168
+ # @return [Gem::Specification] a gemspec object for a given library. Used
169
+ # for :gem source types.
170
+ # @return [nil] if there is no installed gem for the library
41
171
  def gemspec
42
172
  ver = version ? "= #{version}" : ">= 0"
43
173
  Gem.source_index.find_name(name, ver).first
@@ -45,10 +175,19 @@ module YARD
45
175
 
46
176
  protected
47
177
 
178
+ # Called when a library of source type "disk" is to be prepared. In this
179
+ # case, the {#yardoc_file} should already be set, so nothing needs to be
180
+ # done.
48
181
  def load_yardoc_from_disk
49
182
  nil
50
183
  end
51
184
 
185
+ # Called when a library of source type "gem" is to be prepared. In this
186
+ # case, the {#yardoc_file} needs to point to the correct location for
187
+ # the installed gem. The yardoc file is built if it has not been done.
188
+ #
189
+ # @raise [LibraryNotPreparedError] if the gem does not have an existing
190
+ # yardoc file.
52
191
  def load_yardoc_from_gem
53
192
  require 'rubygems'
54
193
  ver = version ? "= #{version}" : ">= 0"
@@ -67,10 +206,12 @@ module YARD
67
206
  end
68
207
  end
69
208
 
209
+ # @return [String] the source path for a disk source
70
210
  def source_path_for_disk
71
211
  File.dirname(yardoc_file) if yardoc_file
72
212
  end
73
213
 
214
+ # @return [String] the source path for a gem source
74
215
  def source_path_for_gem
75
216
  gemspec.full_gem_path if gemspec
76
217
  end
@@ -3,24 +3,57 @@ require 'webrick/httputils'
3
3
 
4
4
  module YARD
5
5
  module Server
6
+ # This class wraps the {RackAdapter} into a Rack-compatible middleware.
7
+ # See {#initialize} for a list of options to pass via Rack's +#use+ method.
8
+ #
9
+ # @note You must pass a +:libraries+ option to the RackMiddleware via +#use+. To
10
+ # read about how to return a list of libraries, see {LibraryVersion} or look
11
+ # at the example below.
12
+ # @example Using the RackMiddleware in a Rack application
13
+ # libraries = {:mylib => [YARD::Server::LibraryVersion.new('mylib', nil, '/path/to/.yardoc')]}
14
+ # use YARD::Server::RackMiddleware, :libraries => libraries
15
+ #
6
16
  class RackMiddleware
17
+ # Creates a new Rack-based middleware for serving YARD documentation.
18
+ #
19
+ # @param app the next Rack middleware in the stack
20
+ # @option opts [Hash{String=>Array<LibraryVersion>}] :libraries ({})
21
+ # the map of libraries to serve through the adapter. This option is *required*.
22
+ # @option opts [Hash] :options ({}) a list of options to pass to the adapter.
23
+ # See {Adapter#options} for a list.
24
+ # @option opts [Hash] :server_options ({}) a list of options to pass to the server.
25
+ # See {Adapter#server_options} for a list.
7
26
  def initialize(app, opts = {})
8
27
  args = [opts[:libraries] || {}, opts[:options] || {}, opts[:server_options] || {}]
9
- @app = RackAdapter.new(*args)
28
+ @app = app
29
+ @adapter = RackAdapter.new(*args)
10
30
  end
11
31
 
12
- def call(env) @app.call(env) end
32
+ def call(env)
33
+ status, headers, body = *@adapter.call(env)
34
+ if status == 404
35
+ @app.call(env)
36
+ else
37
+ [status, headers, body]
38
+ end
39
+ end
13
40
  end
14
41
 
42
+ # A server adapter to respond to requests using the Rack server infrastructure.
15
43
  class RackAdapter < Adapter
16
44
  include WEBrick::HTTPUtils
17
45
 
46
+ # Responds to Rack requests and builds a response with the {Router}.
47
+ # @return [Array(Number,Hash,Array)] the Rack-style response
18
48
  def call(env)
19
49
  request = Rack::Request.new(env)
20
50
  request.path_info = unescape(request.path_info) # unescape things like %3F
21
51
  router.call(request)
22
52
  end
23
53
 
54
+ # Starts the +Rack::Server+. This method will pass control to the server and
55
+ # block.
56
+ # @return [void]
24
57
  def start
25
58
  server = Rack::Server.new(server_options)
26
59
  server.instance_variable_set("@app", self)
@@ -1,17 +1,54 @@
1
1
  module YARD
2
2
  module Server
3
+ # A router class implements the logic used to recognize a request for a specific
4
+ # URL and run specific {Commands::Base commands}.
5
+ #
6
+ # == Subclassing Notes
7
+ # To create a custom router, subclass this class and pass it into the adapter
8
+ # options through {Adapter#initialize} or by directly modifying {Adapter#router}.
9
+ #
10
+ # The most general customization is to change the URL prefixes recognized by
11
+ # routing, which can be done by overriding {#docs_prefix}, {#list_prefix}
12
+ # and {#search_prefix}.
13
+ #
14
+ # == Implementing Custom Caching
15
+ # By default, the Router class performs static disk-based caching on all
16
+ # requests through the +#check_static_cache+. To override this behaviour,
17
+ # or create your own caching mechanism, mixin your own custom module with
18
+ # this method implemented as per {StaticCaching#check_static_cache}.
19
+ #
20
+ # @example Creating a subclassed router
21
+ # # Adds 'my' to all routing prefixes
22
+ # class MyRouter < YARD::Server::Router
23
+ # def docs_prefix; 'mydocs' end
24
+ # def list_prefix; 'mylist' end
25
+ # def search_prefix; 'mysearch' end
26
+ # end
27
+ #
28
+ # # Using it:
29
+ # WebrickAdapter.new(libraries, :router => MyRouter).start
3
30
  class Router
4
31
  include StaticCaching
5
32
  include Commands
6
33
 
34
+ # @return [Adapter Dependent] the request data coming in with the routing
7
35
  attr_accessor :request
8
36
 
37
+ # @return [Adapter] the adapter used by the router
9
38
  attr_accessor :adapter
10
39
 
40
+ # Creates a new router for a specific adapter
41
+ #
42
+ # @param [Adapter] adapter the adapter to route requests to
11
43
  def initialize(adapter)
12
44
  self.adapter = adapter
13
45
  end
14
46
 
47
+ # Perform routing on a specific request, serving the request as a static
48
+ # file through {Commands::StaticFileCommand} if no route is found.
49
+ #
50
+ # @param [Adapter Dependent] request the request object
51
+ # @return [Array(Number,Hash,Array)] the Rack-style server response data
15
52
  def call(request)
16
53
  self.request = request
17
54
  if result = (check_static_cache || route)
@@ -20,11 +57,20 @@ module YARD
20
57
  StaticFileCommand.new(adapter.options).call(request)
21
58
  end
22
59
  end
60
+
61
+ # @group Route Prefixes
23
62
 
63
+ # @return [String] the URI prefix for all object documentation requests
24
64
  def docs_prefix; 'docs' end
65
+
66
+ # @return [String] the URI prefix for all class/method/file list requests
25
67
  def list_prefix; 'list' end
68
+
69
+ # @return [String] the URI prefix for all search requests
26
70
  def search_prefix; 'search' end
27
71
 
72
+ # @group Routing Methods
73
+
28
74
  # @return [Array(LibraryVersion, Array<String>)] the library followed
29
75
  # by the rest of the path components in the request path. LibraryVersion
30
76
  # will be nil if no matching library was found.
@@ -42,8 +88,13 @@ module YARD
42
88
  [library, paths]
43
89
  end
44
90
 
45
- private
91
+ protected
46
92
 
93
+ # Performs routing algorithm to find which prefix is called, first
94
+ # parsing out library name/version information.
95
+ #
96
+ # @return [Array(Numeric,Hash,Array<String>)] the Rack-style response
97
+ # @return [nil] if no route is matched
47
98
  def route
48
99
  path = request.path.gsub(%r{//+}, '/').gsub(%r{^/|/$}, '')
49
100
  return route_index if path.empty? || path == docs_prefix
@@ -62,6 +113,10 @@ module YARD
62
113
  nil
63
114
  end
64
115
 
116
+ # Routes requests from {#docs_prefix} and calls the appropriate command
117
+ # @param [LibraryVersion] library the library to route for
118
+ # @param [Array<String>] paths path components (split by '/')
119
+ # @return (see #route)
65
120
  def route_docs(library, paths)
66
121
  return route_index if library.nil?
67
122
  case paths.first
@@ -78,6 +133,8 @@ module YARD
78
133
  cmd.call(request)
79
134
  end
80
135
 
136
+ # Routes for the index of a library / multiple libraries
137
+ # @return (see #route)
81
138
  def route_index
82
139
  if adapter.options[:single_library]
83
140
  route_docs(adapter.libraries.values.first.first, [])
@@ -86,6 +143,9 @@ module YARD
86
143
  end
87
144
  end
88
145
 
146
+ # Routes requests from {#list_prefix} and calls the appropriate command
147
+ # @param (see #route_docs)
148
+ # @return (see #route_docs)
89
149
  def route_list(library, paths)
90
150
  return if paths.empty?
91
151
  case paths.shift
@@ -97,11 +157,21 @@ module YARD
97
157
  cmd.new(final_options(library, paths)).call(request)
98
158
  end
99
159
 
160
+ # Routes requests from {#search_prefix} and calls the appropriate command
161
+ # @param (see #route_docs)
162
+ # @return (see #route_docs)
100
163
  def route_search(library, paths)
101
164
  return unless paths.empty?
102
165
  SearchCommand.new(final_options(library, paths)).call(request)
103
166
  end
104
167
 
168
+ # @group Utility Methods
169
+
170
+ # Adds extra :library/:path option keys to the adapter options.
171
+ # Use this method when passing options to a command.
172
+ #
173
+ # @param (see #route_docs)
174
+ # @return [Hash] finalized options
105
175
  def final_options(library, paths)
106
176
  adapter.options.merge(:library => library, :path => paths.join('/'))
107
177
  end