Module: YARD::Server::DocServerHelper

Included in:
Commands::FramesCommand
Defined in:
lib/yard/server/doc_server_helper.rb

Overview

Since:

  • 0.6.0

Instance Method Summary collapse

Instance Method Details

#base_path(path) ⇒ Object

Since:

  • 0.6.0



15
16
17
# File 'lib/yard/server/doc_server_helper.rb', line 15

def base_path(path)
  path + (@single_library ? '' : "/#{@library}")
end

#routerObject

Since:

  • 0.6.0



19
# File 'lib/yard/server/doc_server_helper.rb', line 19

def router; @adapter.router end

#url_for(obj, anchor = nil, relative = false) ⇒ Object

Since:

  • 0.6.0



4
5
6
7
8
# File 'lib/yard/server/doc_server_helper.rb', line 4

def url_for(obj, anchor = nil, relative = false)
  return '' if obj.nil?
  return "/#{obj}" if String === obj
  super(obj, anchor, false)
end

#url_for_file(filename, anchor = nil) ⇒ Object

Since:

  • 0.6.0



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

def url_for_file(filename, anchor = nil)
  "/#{base_path(router.docs_prefix)}/file/" + filename.sub(%r{^#{@library.source_path.to_s}/}, '') + 
    (anchor ? "##{anchor}" : "")
end