Class/Module Index [+]

Quicksearch

YARD::Server::DocServerHelper

A module that is mixed into {Templates::Template} in order to customize certain template methods.

Public Instance Methods

base_path(path) click to toggle source

@example The base path for a library 'foo'

base_path('docs') # => 'docs/foo'

@param [String] path the path prefix for a base path URI @return [String] the base URI for a library with an extra path prefix

# File lib/yard/server/doc_server_helper.rb, line 65
def base_path(path)
  libname = router.request.version_supplied ? @library.to_s : @library.name
  path + (@single_library ? '' : "/#{libname}")
end
router() click to toggle source

@return [Router] convenience method for accessing the router

# File lib/yard/server/doc_server_helper.rb, line 71
def router; @adapter.router end
url_for(obj, anchor = nil, relative = false) click to toggle source

Modifies {Templates::Helpers::HtmlHelper#url_for} to return a URL instead of a disk location. @param (see Templates::Helpers::HtmlHelper#url_for) @return (see Templates::Helpers::HtmlHelper#url_for)

# File lib/yard/server/doc_server_helper.rb, line 10
def url_for(obj, anchor = nil, relative = false)
  return '' if obj.nil?
  return url_for_index if obj == '_index.html'
  return "/#{obj}" if String === obj
  File.join('', base_path(router.docs_prefix), super(obj, anchor, false))
end
url_for_file(filename, anchor = nil) click to toggle source

Modifies {Templates::Helpers::HtmlHelper#url_for_file} to return a URL instead of a disk location. @param (see Templates::Helpers::HtmlHelper#url_for_file) @return (see Templates::Helpers::HtmlHelper#url_for_file)

# File lib/yard/server/doc_server_helper.rb, line 21
def url_for_file(filename, anchor = nil)
  if filename.is_a?(CodeObjects::ExtraFileObject)
    filename = filename.filename
  end
  "/#{base_path(router.docs_prefix)}/file/" + filename.sub(%{^#{@library.source_path.to_s}/}, '') +
    (anchor ? "##{anchor}" : "")
end
url_for_frameset() click to toggle source

Returns the frames URL for the page @return (see Templates::Helpers::HtmlHelper#url_for_frameset)

# File lib/yard/server/doc_server_helper.rb, line 39
def url_for_frameset
  url = options.file ? url_for_file(options.file) : url_for(object)
  url = url.gsub(%{^/#{base_path(router.docs_prefix)}/}, '')
  File.join('', base_path(router.docs_prefix), "frames", url)
end
url_for_index() click to toggle source

Returns the URL for the alphabetic index page @return (see Templates::Helpers::HtmlHelper#url_for_index)

# File lib/yard/server/doc_server_helper.rb, line 57
def url_for_index
  File.join('', base_path(router.docs_prefix), 'index')
end
url_for_list(type) click to toggle source

Modifies {Templates::Helpers::HtmlHelper#url_for_list} to return a URL based on the list prefix instead of a HTML filename. @param (see Templates::Helpers::HtmlHelper#url_for_list) @return (see Templates::Helpers::HtmlHelper#url_for_list)

# File lib/yard/server/doc_server_helper.rb, line 33
def url_for_list(type)
  File.join('', base_path(router.list_prefix), type.to_s)
end
url_for_main() click to toggle source

Returns the main URL, first checking a readme and then linking to the index @return (see Templates::Helpers::HtmlHelper#url_for_main)

# File lib/yard/server/doc_server_helper.rb, line 47
def url_for_main
  if options.frames && !options.command.path.empty?
    File.join('', base_path(router.docs_prefix), options.command.path)
  else
    options.readme ? url_for_file(options.readme) : url_for_index
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.