Class: RDocF95::CodeObject
- Inherits:
-
Object
- Object
- RDocF95::CodeObject
- Defined in:
- lib/rdoc-f95/code_objects.rb
Overview
We contain the common stuff for contexts (which are containers) and other elements (methods, attributes and so on)
Instance Attribute Summary collapse
-
#comment ⇒ Object
Access the code object’s comment.
-
#document_children ⇒ Object
do we document ourselves and our children.
-
#document_self ⇒ Object
do we document ourselves?.
-
#done_documenting ⇒ Object
are we done documenting (ie, did we come across a :enddoc:)?.
-
#force_documentation ⇒ Object
Do we force documentation, even is we wouldn’t normally show the entity.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#section ⇒ Object
Which section are we in.
-
#viewer ⇒ Object
We are the model of the code, but we know that at some point we will be worked on by viewers.
Class Method Summary collapse
-
.attr_overridable(name, *aliases) ⇒ Object
There’s a wee trick we pull.
Instance Method Summary collapse
-
#initialize ⇒ CodeObject
constructor
A new instance of CodeObject.
-
#remove_classes_and_modules ⇒ Object
Default callbacks to nothing, but this is overridden for classes and modules.
- #remove_methods_etc ⇒ Object
-
#start_doc ⇒ Object
set and cleared by :startdoc: and :enddoc:, this is used to toggle the capturing of documentation.
- #stop_doc ⇒ Object
Constructor Details
#initialize ⇒ CodeObject
Returns a new instance of CodeObject.
75 76 77 78 79 80 |
# File 'lib/rdoc-f95/code_objects.rb', line 75 def initialize @document_self = true @document_children = true @force_documentation = false @done_documenting = false end |
Instance Attribute Details
#comment ⇒ Object
Access the code object’s comment
83 84 85 |
# File 'lib/rdoc-f95/code_objects.rb', line 83 def comment @comment end |
#document_children ⇒ Object
do we document ourselves and our children
55 56 57 |
# File 'lib/rdoc-f95/code_objects.rb', line 55 def document_children @document_children end |
#document_self ⇒ Object
do we document ourselves?
32 33 34 |
# File 'lib/rdoc-f95/code_objects.rb', line 32 def document_self @document_self end |
#done_documenting ⇒ Object
are we done documenting (ie, did we come across a :enddoc:)?
24 25 26 |
# File 'lib/rdoc-f95/code_objects.rb', line 24 def done_documenting @done_documenting end |
#force_documentation ⇒ Object
Do we force documentation, even is we wouldn’t normally show the entity
65 66 67 |
# File 'lib/rdoc-f95/code_objects.rb', line 65 def force_documentation @force_documentation end |
#parent ⇒ Object
Returns the value of attribute parent
14 15 16 |
# File 'lib/rdoc-f95/code_objects.rb', line 14 def parent @parent end |
#section ⇒ Object
Which section are we in
28 29 30 |
# File 'lib/rdoc-f95/code_objects.rb', line 28 def section @section end |
#viewer ⇒ Object
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.
20 21 22 |
# File 'lib/rdoc-f95/code_objects.rb', line 20 def viewer @viewer end |
Class Method Details
.attr_overridable(name, *aliases) ⇒ Object
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
96 97 98 99 100 101 102 103 104 105 |
# File 'lib/rdoc-f95/code_objects.rb', line 96 def self.attr_overridable(name, *aliases) @overridables ||= {} attr_accessor name aliases.unshift name aliases.each do |directive_name| @overridables[directive_name.to_s] = name end end |
Instance Method Details
#remove_classes_and_modules ⇒ Object
Default callbacks to nothing, but this is overridden for classes and modules
69 70 |
# File 'lib/rdoc-f95/code_objects.rb', line 69 def remove_classes_and_modules end |
#remove_methods_etc ⇒ Object
72 73 |
# File 'lib/rdoc-f95/code_objects.rb', line 72 def remove_methods_etc end |
#start_doc ⇒ Object
set and cleared by :startdoc: and :enddoc:, this is used to toggle the capturing of documentation
43 44 45 46 |
# File 'lib/rdoc-f95/code_objects.rb', line 43 def start_doc @document_self = true @document_children = true end |
#stop_doc ⇒ Object
48 49 50 51 |
# File 'lib/rdoc-f95/code_objects.rb', line 48 def stop_doc @document_self = false @document_children = false end |