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, line 149
def initialize(index, name, location)
  @index = index
  @name = name
  @location = location
end

Public Instance Methods

manual?() click to toggle source
# File lib/ronn/index.rb, line 155
def manual?
  name =~ /\([0-9]\w*\)$/
end
path() click to toggle source
# File lib/ronn/index.rb, line 179
def path
  File.expand_path(location, File.dirname(@index.path)) if relative?
end
relative?() click to toggle source
# File lib/ronn/index.rb, line 167
def relative?
  !remote?
end
remote?() click to toggle source
# File lib/ronn/index.rb, line 163
def remote?
  location =~ /^(?:https?|mailto):/
end
ronn?() click to toggle source
# File lib/ronn/index.rb, line 159
def ronn?
  location =~ /\.ronn?$/
end
url() click to toggle source
# File lib/ronn/index.rb, line 171
def url
  if remote?
    location
  else
    location.chomp('.ronn') + '.html'
  end
end