123456789_123456789_123456789_123456789_123456789_

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

MARKUP_FORMAT, TO_HTML_CHARACTERS

Class Method Summary

CodeObject - Inherited

.new

Creates a new CodeObject that will document itself and its children.

Instance Attribute Summary

CodeObject - Inherited

#comment

Our comment.

#comment=

Replaces our comment with comment, unless it is empty.

#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 CodeObject unless it has been turned off by :enddoc:.

#done_documenting

Are we done documenting (ie, did we come across a :enddoc:)?

#done_documenting=

Turns documentation on/off, and turns on/off #document_self and #document_children.

#force_documentation

Force documentation of this CodeObject.

#force_documentation=

Force the documentation of this object unless documentation has been turned off by :enddoc:

#line

Line in #file where this CodeObject was defined.

#offset

Offset in #file where this CodeObject was defined.

#parent

Our parent CodeObject.

#parent=

Sets the parent CodeObject.

#section

The section this CodeObject is in.

#section=

Set the section this CodeObject is in.

#store

The Store for this object.

#store=

Sets the store that contains this CodeObject.

#viewer

We are the model of the code, but we know that at some point we will be worked on by viewers.

#display?

Should this CodeObject be displayed in output?

#documented?

Does this object have a comment with content or is #received_nodoc true?

#file

Which file this code object was defined in.

#ignored?

Has this class been ignored?

#metadata

Hash of arbitrary metadata for this CodeObject.

#received_nodoc

Did we ever receive a :nodoc: directive?

#suppressed?

Has this class been suppressed?

#full_name=

Sets the full_name overriding any computed full name.

Instance Method Summary

CodeObject - Inherited

#each_parent

Yields each parent of this CodeObject.

#file_name

File name where this CodeObject was found.

#ignore

Use this to ignore a CodeObject and all its children until found again (#record_location is called).

#options

The options instance from the store this CodeObject is attached to, or a default options instance if the CodeObject is not attached.

#parent_file_name

File name of our parent.

#parent_name

Name of our parent.

#record_location

Records the TopLevel (file) where this code object was defined.

#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 CodeObject and all its children until the next file it is seen in or documentation is discovered.

Generator::Markup - Included

#aref_to

Generates a relative URL from this object's path to target_path

#as_href

Generates a relative URL from from_path to this object's path.

#cvs_url

Build a webcvs URL starting for the given url with full_path appended as the destination path.

#description

Handy wrapper for marking up this object's comment.

#formatter

Creates an Markup::ToHtmlCrossref formatter.

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 Markup::Document from it.

#snippet

The first limit characters of #text as HTML.

#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 txt to line_len

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.

[ GitHub ]

  
# File '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 Attribute Details

#name (readonly)

Alias for #new_name.

[ GitHub ]

  
# File 'lib/rdoc/alias.rb', line 16

alias name new_name

#new_name (readonly) Also known as: #name

Aliased method's name

[ GitHub ]

  
# File 'lib/rdoc/alias.rb', line 14

attr_reader :new_name

#old_name (readonly)

Aliasee method's name

[ GitHub ]

  
# File 'lib/rdoc/alias.rb', line 21

attr_reader :old_name

#singleton (rw)

Is this an alias declared in a singleton context?

[ GitHub ]

  
# File 'lib/rdoc/alias.rb', line 26

attr_accessor :singleton

#text (readonly)

Source file token stream

[ GitHub ]

  
# File 'lib/rdoc/alias.rb', line 31

attr_reader :text

Instance Method Details

#<=>(other)

Order by #singleton then #new_name

[ GitHub ]

  
# File '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

[ GitHub ]

  
# File '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

[ GitHub ]

  
# 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.

[ GitHub ]

  
# File '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.

[ GitHub ]

  
# File 'lib/rdoc/alias.rb', line 87

def name_prefix
  singleton ? '::' : '#'
end

#pretty_name

Alias for #pretty_new_name.

[ GitHub ]

  
# 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 '#'.

[ GitHub ]

  
# File 'lib/rdoc/alias.rb', line 101

def pretty_new_name
  "#{singleton ? '::' : '#'}#{@new_name}"
end

#pretty_old_name

Old name with prefix '::' or '#'.

[ GitHub ]

  
# File 'lib/rdoc/alias.rb', line 94

def pretty_old_name
  "#{singleton ? '::' : '#'}#{@old_name}"
end