Skip to Content Skip to Search

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

Methods
#
A
F
H
N
P

Attributes

[R] name

Aliased method’s name

[R] new_name

Aliased method’s name

[R] old_name

Aliasee method’s name

[RW] singleton

Is this an alias declared in a singleton context?

[R] text

Source file token stream

Class Public methods

new(text, old_name, new_name, comment, singleton = false)

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

# File ruby/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

Instance Public methods

<=>(other)

Order by singleton then new_name

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

aref()

HTML fragment reference for this alias

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

full_old_name()

Full old name including namespace

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

html_name()

HTML id-friendly version of #new_name.

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

name_prefix()

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

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

pretty_name()

Alias for: pretty_new_name

pretty_new_name()

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

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

pretty_old_name()

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

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