class RDoc::Alias
Represent an alias, which is an old_name/new_name pair associated with a particular context
Represent an alias, which is an old_name/new_name pair associated with a particular context
Attributes
Aliased methodโs name
Aliasee methodโs name
singleton
[R]
bool
Is this an alias declared in a singleton context?
Public Class Methods
(String? text, String name, String old_name, RDoc::Comment? comment, ?singleton: bool) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/rdoc/0/rdoc.rbs, line 384
def initialize: (String? text, String name, String old_name, RDoc::Comment? comment, ?singleton: bool) -> void
# File vendor/bundle/ruby/4.0.0/gems/rdoc-8.0.0/lib/rdoc/code_object/alias.rb, line 32 def initialize(old_name, new_name, comment, singleton: false) super() @singleton = singleton @old_name = old_name @new_name = new_name self.comment = comment end
Creates a new Alias that aliases old_name to new_name, has comment and is a singleton context.
Calls superclass method
RDoc::CodeObject::new
Public Instance Methods
Source
# File vendor/bundle/ruby/4.0.0/gems/rdoc-8.0.0/lib/rdoc/code_object/alias.rb, line 44 def <=>(other) [@singleton ? 0 : 1, new_name] <=> [other.singleton ? 0 : 1, other.new_name] end
Source
# File vendor/bundle/ruby/4.0.0/gems/rdoc-8.0.0/lib/rdoc/code_object/alias.rb, line 51 def aref type = singleton ? 'c' : 'i' "#alias-#{type}-#{html_name}" end
HTML fragment reference for this alias
Source
# File vendor/bundle/ruby/4.0.0/gems/rdoc-8.0.0/lib/rdoc/code_object/alias.rb, line 59 def html_name CGI.escape(@new_name.gsub('-', '-2D')).gsub('%', '-').sub(/^-/, '') end
HTML id-friendly version of new_name.
Source
# File vendor/bundle/ruby/4.0.0/gems/rdoc-8.0.0/lib/rdoc/code_object/alias.rb, line 74 def name_prefix singleton ? '::' : '#' end
โ::โ for the alias of a singleton method/attribute, โ#โ for instance-level.
Source
# File vendor/bundle/ruby/4.0.0/gems/rdoc-8.0.0/lib/rdoc/code_object/alias.rb, line 88 def pretty_new_name "#{singleton ? '::' : '#'}#{@new_name}" end
New name with prefix โ::โ or โ#โ.
Also aliased as: pretty_name
Source
# File vendor/bundle/ruby/4.0.0/gems/rdoc-8.0.0/lib/rdoc/code_object/alias.rb, line 81 def pretty_old_name "#{singleton ? '::' : '#'}#{@old_name}" end
Old name with prefix โ::โ or โ#โ.