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 149 def initialize(index, name, location) 150 @index = index 151 @name = name 152 @location = location 153 end
Public Instance Methods
manual?()
click to toggle source
# File lib/ronn/index.rb 155 def manual? 156 name =~ /\([0-9]\w*\)$/ 157 end
path()
click to toggle source
# File lib/ronn/index.rb 179 def path 180 File.expand_path(location, File.dirname(@index.path)) if relative? 181 end
relative?()
click to toggle source
# File lib/ronn/index.rb 167 def relative? 168 !remote? 169 end
remote?()
click to toggle source
# File lib/ronn/index.rb 163 def remote? 164 location =~ /^(?:https?|mailto):/ 165 end
ronn?()
click to toggle source
# File lib/ronn/index.rb 159 def ronn? 160 location =~ /\.ronn?$/ 161 end
url()
click to toggle source
# File lib/ronn/index.rb 171 def url 172 if remote? 173 location 174 else 175 location.chomp('.ronn') + '.html' 176 end 177 end