Class: Jazzy::SourceHost::GitHub
- Inherits:
-
Object
- Object
- Jazzy::SourceHost::GitHub
- Includes:
- Config::Mixin
- Defined in:
- lib/jazzy/source_host.rb
Overview
Use GitHub as the default behaviour.
Instance Method Summary collapse
-
#extension ⇒ Object
Jazzy extension with logo.
-
#image ⇒ Object
Logo image filename within extension.
-
#item_url(item) ⇒ Object
URL to link to from a SourceDeclaration.
-
#name ⇒ Object
Human readable name, appears in UI.
-
#url ⇒ Object
URL to link to from logo.
Methods included from Config::Mixin
Instance Method Details
#extension ⇒ Object
Jazzy extension with logo
27 28 29 |
# File 'lib/jazzy/source_host.rb', line 27 def extension name.downcase end |
#image ⇒ Object
Logo image filename within extension
32 33 34 |
# File 'lib/jazzy/source_host.rb', line 32 def image 'gh.png' end |
#item_url(item) ⇒ Object
URL to link to from a SourceDeclaration. Compare using ‘realpath` because `item.file` comes out of SourceKit/etc.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/jazzy/source_host.rb', line 44 def item_url(item) return unless files_url && item.file realpath = item.file.realpath return unless realpath.to_path.start_with?(local_root_realpath) path = realpath.relative_path_from(local_root_realpath) fragment = if item.start_line && (item.start_line != item.end_line) item_url_multiline_fragment(item.start_line, item.end_line) else item_url_line_fragment(item.line) end "#{files_url}/#{path}##{fragment}" end |
#name ⇒ Object
Human readable name, appears in UI
22 23 24 |
# File 'lib/jazzy/source_host.rb', line 22 def name 'GitHub' end |
#url ⇒ Object
URL to link to from logo
37 38 39 |
# File 'lib/jazzy/source_host.rb', line 37 def url config.source_host_url end |