Class: RDoc::Alias
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
CodeObject
|
|
Instance Chain:
|
|
Inherits: |
RDoc::CodeObject
|
Defined in: | lib/rdoc/alias.rb |
Overview
Represent an alias, which is an old_name/new_name pair associated with a particular context
Constant Summary
Text
- Included
Class Method Summary
-
.new(text, old_name, new_name, comment, singleton = false) ⇒ Alias
constructor
Creates a new
Alias
with a token stream of #text that aliases #old_name to #new_name, hascomment
and is a #singleton context.
CodeObject
- Inherited
.new | Creates a new |
Instance Attribute Summary
-
#name
readonly
Alias
for #new_name. -
#new_name
(also: #name)
readonly
Aliased method’s name.
-
#old_name
readonly
Aliasee method’s name.
-
#singleton
rw
Is this an alias declared in a singleton context?
-
#text
readonly
Source file token stream.
CodeObject
- Inherited
#comment | Our comment. |
#comment= | Replaces our comment with |
#display? | Should this |
#document_children | Do we document our children? |
#document_children= | Enables or disables documentation of this CodeObject’s children unless it has been turned off by :enddoc: |
#document_self | Do we document ourselves? |
#document_self= | Enables or disables documentation of this |
#documented? | Does this object have a comment with content or is |
#done_documenting | Are we done documenting (ie, did we come across a :enddoc:)? |
#done_documenting= | Turns documentation on/off, and turns on/off |
#file | Which file this code object was defined in. |
#force_documentation | Force documentation of this |
#force_documentation= | Force the documentation of this object unless documentation has been turned off by :enddoc: |
#full_name= | Sets the full_name overriding any computed full name. |
#ignored? | Has this class been ignored? |
#line | Line in |
#metadata | Hash of arbitrary metadata for this |
#parent | Our parent |
#parent= | Sets the parent |
#received_nodoc | Did we ever receive a |
#section | The section this |
#section= | Set the section this |
#store | The |
#store= | Sets the |
#suppressed? | Has this class been suppressed? |
#viewer | We are the model of the code, but we know that at some point we will be worked on by viewers. |
Instance Method Summary
-
#<=>(other)
Order by #singleton then #new_name
-
#aref
HTML fragment reference for this alias.
-
#full_old_name
Full old name including namespace.
-
#html_name
HTML id-friendly version of #new_name.
-
#name_prefix
‘::’ for the alias of a singleton method/attribute, ‘#’ for instance-level.
-
#pretty_name
Alias
for #pretty_new_name. -
#pretty_new_name
(also: #pretty_name)
New name with prefix ‘::’ or ‘#’.
-
#pretty_old_name
Old name with prefix ‘::’ or ‘#’.
- #inspect Internal use only
- #to_s Internal use only
CodeObject
- Inherited
#each_parent | Yields each parent of this |
#file_name | File name where this |
#ignore | Use this to ignore a |
#options | The options instance from the store this |
#parent_file_name | File name of our parent. |
#parent_name | Name of our parent. |
#record_location | Records the |
#start_doc | Enable capture of documentation unless documentation has been turned off by :enddoc: |
#stop_doc | Disable capture of documentation. |
#suppress | Use this to suppress a |
#initialize_visibility | Initializes state for visibility of this |
Generator::Markup
- Included
#aref_to | Generates a relative URL from this object’s path to |
#as_href | Generates a relative URL from |
#cvs_url | Build a webcvs URL starting for the given |
#description | Handy wrapper for marking up this object’s comment. |
#formatter | Creates an |
Text
- Included
#expand_tabs | Expands tab characters in #text to eight spaces. |
#flush_left | Flush #text left based on the shortest line. |
#markup | Convert a string in markup format into HTML. |
#normalize_comment | Strips hashes, expands tabs then flushes #text to the left. |
#parse | Normalizes #text then builds a |
#snippet | The first |
#strip_hashes | Strips leading # characters from #text |
#strip_newlines | Strips leading and trailing n characters from #text |
#strip_stars | Strips /* */ style comments. |
#to_html | Converts ampersand, dashes, ellipsis, quotes, copyright and registered trademark symbols in #text to properly encoded characters. |
#wrap | Wraps |
Constructor Details
.new(text, old_name, new_name, comment, singleton = false) ⇒ Alias
Creates a new Alias
with a token stream of #text that aliases #old_name to #new_name, has comment
and is a #singleton context.
Instance Attribute Details
#name (readonly)
Alias
for #new_name.
# File 'lib/rdoc/alias.rb', line 16
alias name new_name
#new_name (readonly) Also known as: #name
Aliased method’s name
# File 'lib/rdoc/alias.rb', line 14
attr_reader :new_name
#old_name (readonly)
Aliasee method’s name
# File 'lib/rdoc/alias.rb', line 21
attr_reader :old_name
#singleton (rw)
Is this an alias declared in a singleton context?
# File 'lib/rdoc/alias.rb', line 26
attr_accessor :singleton
#text (readonly)
Source file token stream
# File 'lib/rdoc/alias.rb', line 31
attr_reader :text
Instance Method Details
#<=>(other)
Order by #singleton then #new_name
#aref
HTML fragment reference for this alias
#full_old_name
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_name
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
#inspect
# File 'lib/rdoc/alias.rb', line 76
def inspect # :nodoc: parent_name = parent ? parent.name : '(unknown)' "#<%s:0x%x %s.alias_method %s, %s>" % [ self.class, object_id, parent_name, @old_name, @new_name, ] end
#name_prefix
‘::’ for the alias of a singleton method/attribute, ‘#’ for instance-level.
# File 'lib/rdoc/alias.rb', line 87
def name_prefix singleton ? '::' : '#' end
#pretty_name
Alias
for #pretty_new_name.
# File 'lib/rdoc/alias.rb', line 105
alias pretty_name pretty_new_name
#pretty_new_name Also known as: #pretty_name
New name with prefix ‘::’ or ‘#’.
# File 'lib/rdoc/alias.rb', line 101
def pretty_new_name "#{singleton ? '::' : '#'}#{@new_name}" end
#pretty_old_name
Old name with prefix ‘::’ or ‘#’.
# File 'lib/rdoc/alias.rb', line 94
def pretty_old_name "#{singleton ? '::' : '#'}#{@old_name}" end
#to_s
# File 'lib/rdoc/alias.rb', line 107
def to_s # :nodoc: "alias: #{self.new_name} -> #{self.pretty_old_name} in: #{parent}" end