# class 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 lib/rdoc/constant.rb, line 26
    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 lib/rdoc/constant.rb, line 37
    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 lib/rdoc/constant.rb, line 46
    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 lib/rdoc/constant.rb, line 56
    def documented?
      super or is_alias_for && is_alias_for.documented?
    end

path() click to toggle source

Path to this constant

    # File lib/rdoc/constant.rb, line 70
    def path
      "#{@parent.path}##{@name}"
    end