class RDoc::Alias

Represent an alias, which is an old_name/new_name pair associated with a particular context

Attributes

Aliased method’s name

Aliased method’s name

Aliasee method’s name

Is this an alias declared in a singleton context?

Source file token stream

Public Class Methods

Creates a new Alias with a token stream of text that aliases old_name to new_name, has comment and is a singleton context.

Calls superclass method RDoc::CodeObject::new
# File lib/rdoc/alias.rb, line 37
def initialize(text, old_name, new_name, comment, singleton = false)
  super()

  @text = text
  @singleton = singleton
  @old_name = old_name
  @new_name = new_name
  self.comment = comment
end

Public Instance Methods

Order by singleton then new_name

# File lib/rdoc/alias.rb, line 50
def <=>(other)
  [@singleton ? 0 : 1, new_name] <=> [other.singleton ? 0 : 1, other.new_name]
end

HTML fragment reference for this alias

# File lib/rdoc/alias.rb, line 57
def aref
  type = singleton ? 'c' : 'i'
  "#alias-#{type}-#{html_name}"
end

Full old name including namespace

# File lib/rdoc/alias.rb, line 65
def full_old_name
  @full_name || "#{parent.name}#{pretty_old_name}"
end

HTML id-friendly version of new_name.

# File lib/rdoc/alias.rb, line 72
def html_name
  CGI.escape(@new_name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '')
end

‘::’ for the alias of a singleton method/attribute, ‘#’ for instance-level.

# File lib/rdoc/alias.rb, line 87
def name_prefix
  singleton ? '::' : '#'
end

New name with prefix ‘::’ or ‘#’.

# File lib/rdoc/alias.rb, line 101
def pretty_new_name
  "#{singleton ? '::' : '#'}#{@new_name}"
end
Also aliased as: pretty_name

Old name with prefix ‘::’ or ‘#’.

# File lib/rdoc/alias.rb, line 94
def pretty_old_name
  "#{singleton ? '::' : '#'}#{@old_name}"
end