Represent an alias, which is an old_name/new_name pair associated with a particular context
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 38 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
HTML fragment reference for this alias
# File rdoc/alias.rb, line 58 def aref type = singleton ? 'c' : 'i' "#alias-#{type}-#{html_name}" end
Full old name including namespace
# File rdoc/alias.rb, line 66 def full_old_name @full_name || "#{parent.name}#{pretty_old_name}" end
HTML id-friendly version of #new_name
.
# File rdoc/alias.rb, line 73 def html_name CGI.escape(@new_name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '') end
‘::’ for the alias of a singleton method/attribute, ‘#’ for instance-level.
# File rdoc/alias.rb, line 88 def name_prefix singleton ? '::' : '#' end
New name with prefix ‘::’ or ‘#’.
# File rdoc/alias.rb, line 102 def pretty_new_name "#{singleton ? '::' : '#'}#{@new_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 see Improve the docs, or visit Documenting-ruby.org.