Class | RDoc::CodeObject
In: | rdoc/code_objects.rb
Parent: | Object

We contain the common stuff for contexts (which are containers) and other elements (methods, attributes and so on)

### Methods

attr_overridable comment= document_children= document_self= new remove_classes_and_modules remove_methods_etc start_doc stop_doc

### Attributes

comment | [R] | Access the code object’s comment
document_children | [R] | do we document ourselves and our children
document_self | [R] | do we document ourselves?
done_documenting | [RW] | are we done documenting (ie, did we come across a :enddoc:)?
force_documentation | [RW] | Do we force documentation, even is we wouldn’t normally show the entity
parent | [RW] |
section | [RW] | Which section are we in
viewer | [RW] | We are the model of the code, but we know that at some point we will be worked on by viewers. By implementing the Viewable protocol, viewers can associated themselves with these objects.

### Public Class methods

attr_overridable(name, *aliases)

There’s a wee trick we pull. Comment blocks can have directives that override the stuff we extract during the parse. So, we have a special class method, attr_overridable, that lets code objects list those directives. Wehn a comment is assigned, we then extract out any matching directives and update our object

[Source]

    # File rdoc/code_objects.rb, line 97
        def CodeObject.attr_overridable(name, *aliases)
          @overridables ||= {}

          attr_accessor name

          aliases.unshift name
          aliases.each do |directive_name|
            @overridables[directive_name.to_s] = name
          end
        end

new()

[Source]

    # File rdoc/code_objects.rb, line 75
        def initialize
          @document_self = true
          @document_children = true
          @force_documentation = false
          @done_documenting = false
        end

### Public Instance methods

comment=(comment)

Update the comment, but don’t overwrite a real comment with an empty one

[Source]

    # File rdoc/code_objects.rb, line 87
        def comment=(comment)
          @comment = comment unless comment.empty?
        end

document_children=(val)

[Source]

    # File rdoc/code_objects.rb, line 57
        def document_children=(val)
          @document_children = val
          if !val
            remove_classes_and_modules
          end
        end

document_self=(val)

[Source]

    # File rdoc/code_objects.rb, line 34
        def document_self=(val)
          @document_self = val
          if !val
            remove_methods_etc
          end
        end

remove_classes_and_modules()

Default callbacks to nothing, but this is overridden for classes and modules

[Source]

    # File rdoc/code_objects.rb, line 69
        def remove_classes_and_modules
        end

remove_methods_etc()

[Source]

    # File rdoc/code_objects.rb, line 72
        def remove_methods_etc
        end

start_doc()

set and cleared by :startdoc: and :enddoc:, this is used to toggle the capturing of documentation

[Source]

    # File rdoc/code_objects.rb, line 43
        def start_doc
          @document_self = true
          @document_children = true
        end

stop_doc()

[Source]

    # File rdoc/code_objects.rb, line 48
        def stop_doc
          @document_self = false
          @document_children = false
        end

[Validate]