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