class Ronn::Reference
An individual index reference. A reference can point to one of a few types of locations:
- URLs: "http://man.cx/crontab(5)" - Relative paths to ronn manuals: "crontab.5.ronn"
The url
method should be used to obtain the href value for HTML.
Attributes
location[R]
name[R]
Public Class Methods
new(index, name, location)
click to toggle source
# File lib/ronn/index.rb 146 def initialize(index, name, location) 147 @index = index 148 @name = name 149 @location = location 150 end
Public Instance Methods
manual?()
click to toggle source
# File lib/ronn/index.rb 152 def manual? 153 name =~ /\([0-9]\w*\)$/ 154 end
path()
click to toggle source
# File lib/ronn/index.rb 176 def path 177 File.expand_path(location, File.dirname(@index.path)) if relative? 178 end
relative?()
click to toggle source
# File lib/ronn/index.rb 164 def relative? 165 !remote? 166 end
remote?()
click to toggle source
# File lib/ronn/index.rb 160 def remote? 161 location =~ /^(?:https?|mailto):/ 162 end
ronn?()
click to toggle source
# File lib/ronn/index.rb 156 def ronn? 157 location =~ /\.ronn?$/ 158 end
url()
click to toggle source
# File lib/ronn/index.rb 168 def url 169 if remote? 170 location 171 else 172 location.chomp('.ronn') + '.html' 173 end 174 end