Extended maintenance of Ruby 1.9.3 ended on February 23, 2015. Read more

In Files

  • rdoc/constant.rb
  • rdoc/generator/markup.rb

Class/Module Index [+]

Quicksearch

RDoc::Constant

A constant

Attributes

is_alias_for[RW]

If this constant is an alias for a module or class, this is the RDoc::ClassModule it is an alias for. nil otherwise.

name[RW]

The constant’s name

value[RW]

The constant’s value

Public Class Methods

new(name, value, comment) click to toggle source

Creates a new constant with name, value and comment

 
               # File rdoc/constant.rb, line 28
def initialize(name, value, comment)
  super()
  @name = name
  @value = value
  @is_alias_for = nil
  self.comment = comment
end
            

Public Instance Methods

<=>(other) click to toggle source

Constants are ordered by name

 
               # File rdoc/constant.rb, line 39
def <=> other
  return unless self.class === other

  [parent_name, name] <=> [other.parent_name, other.name]
end
            
==(other) click to toggle source

Constants are equal when their parent and name is the same

 
               # File rdoc/constant.rb, line 48
def == other
  self.class == other.class and
    @parent == other.parent and
    @name == other.name
end
            
documented?() click to toggle source

A constant is documented if it has a comment, or is an alias for a documented class or module.

 
               # File rdoc/constant.rb, line 58
def documented?
  super or is_alias_for && is_alias_for.documented?
end
            
path() click to toggle source

Path to this constant

 
               # File rdoc/constant.rb, line 72
def path
  "#{@parent.path}##{@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.