In Files

  • rdoc/code_objects.rb

Files

Class/Module Index [+]

Quicksearch

RDoc::ClassModule

ClassModule is the base class for objects representing either a class or a module.

Attributes

diagram[RW]

Public Class Methods

new(name, superclass = nil) click to toggle source
 
               # File rdoc/code_objects.rb, line 707
def initialize(name, superclass = nil)
  @name       = name
  @diagram    = nil
  @superclass = superclass
  @comment    = ""
  super()
end
            

Public Instance Methods

find_class_named(name) click to toggle source
 
               # File rdoc/code_objects.rb, line 715
def find_class_named(name)
  return self if full_name == name
  @classes.each_value {|c| return c if c.find_class_named(name) }
  nil
end
            
full_name() click to toggle source

Return the fully qualified name of this class or module

 
               # File rdoc/code_objects.rb, line 724
def full_name
  if @parent && @parent.full_name
    @parent.full_name + "::" + @name
  else
    @name
  end
end
            
http_url(prefix) click to toggle source
 
               # File rdoc/code_objects.rb, line 732
def http_url(prefix)
  path = full_name.split("::")
  File.join(prefix, *path) + ".html"
end
            
module?() click to toggle source

Does this object represent a module?

 
               # File rdoc/code_objects.rb, line 740
def module?
  false
end
            
superclass() click to toggle source

Get the superclass of this class. Attempts to retrieve the superclass’ real name by following module nesting.

 
               # File rdoc/code_objects.rb, line 748
def superclass
  raise NoMethodError, "#{full_name} is a module" if module?

  scope = self

  begin
    superclass = scope.classes.find { |c| c.name == @superclass }

    return superclass.full_name if superclass
    scope = scope.parent
  end until scope.nil? or TopLevel === scope

  @superclass
end
            
superclass=(superclass) click to toggle source

Set the superclass of this class

 
               # File rdoc/code_objects.rb, line 766
def superclass=(superclass)
  raise NoMethodError, "#{full_name} is a module" if module?

  if @superclass.nil? or @superclass == 'Object' then
    @superclass = superclass 
  end
end
            
to_s() click to toggle source
 
               # File rdoc/code_objects.rb, line 774
def to_s
  "#{self.class}: #{@name} #{@comment} #{super}"
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.

blog comments powered by Disqus