In Files

  • rdoc/alias.rb

Class/Module Index [+]

Quicksearch

RDoc::Alias

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

Attributes

name[R]

Aliased method’s name

new_name[R]

Aliased method’s name

old_name[R]

Aliasee method’s name

singleton[RW]

Is this an alias declared in a singleton context?

text[R]

Source file token stream

Public Class Methods

new(text, old_name, new_name, comment, singleton = false) click to toggle source

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 rdoc/alias.rb, line 36
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

<=>(other) click to toggle source

Order by singleton then new_name

 
               # File rdoc/alias.rb, line 49
def <=>(other)
  [@singleton ? 0 : 1, new_name] <=> [other.singleton ? 0 : 1, other.new_name]
end
            
aref() click to toggle source

HTML fragment reference for this alias

 
               # File rdoc/alias.rb, line 56
def aref
  type = singleton ? 'c' : 'i'
  "#alias-#{type}-#{html_name}"
end
            
full_old_name() click to toggle source

Full old name including namespace

 
               # File rdoc/alias.rb, line 64
def full_old_name
  @full_name || "#{parent.name}#{pretty_old_name}"
end
            
html_name() click to toggle source

HTML id-friendly version of #new_name.

 
               # File rdoc/alias.rb, line 71
def html_name
  CGI.escape(@new_name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '')
end
            
name_prefix() click to toggle source

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

 
               # File rdoc/alias.rb, line 86
def name_prefix
  singleton ? '::' : '#'
end
            
pretty_name() click to toggle source
Alias for: pretty_new_name
pretty_new_name() click to toggle source

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

 
               # File rdoc/alias.rb, line 100
def pretty_new_name
  "#{singleton ? '::' : '#'}#{@new_name}"
end
            
Also aliased as: pretty_name
pretty_old_name() click to toggle source

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

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

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus