Module: YARD::Server::DocServerHelper
- Included in:
- Commands::FramesCommand
- Defined in:
- lib/yard/server/doc_server_helper.rb
Overview
Instance Method Summary collapse
- #base_path(path) ⇒ Object
- #router ⇒ Object
- #url_for(obj, anchor = nil, relative = false) ⇒ Object
- #url_for_file(filename, anchor = nil) ⇒ Object
Instance Method Details
#base_path(path) ⇒ Object
15 16 17 |
# File 'lib/yard/server/doc_server_helper.rb', line 15 def base_path(path) path + (@single_library ? '' : "/#{@library}") end |
#router ⇒ Object
19 |
# File 'lib/yard/server/doc_server_helper.rb', line 19 def router; @adapter.router end |
#url_for(obj, anchor = nil, relative = false) ⇒ Object
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
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 |