| Class | RDoc::CodeObject |
| In: |
code_objects.rb
doc-tmp/rdoc/code_objects.rb |
| Parent: | Object |
We contain the common stuff for contexts (which are containers) and other elements (methods, attributes and so on)
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
# File doc-tmp/rdoc/code_objects.rb, line 96
96: def self.attr_overridable(name, *aliases)
97: @overridables ||= {}
98:
99: attr_accessor name
100:
101: aliases.unshift name
102: aliases.each do |directive_name|
103: @overridables[directive_name.to_s] = name
104: end
105: end
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
# File code_objects.rb, line 96
96: def self.attr_overridable(name, *aliases)
97: @overridables ||= {}
98:
99: attr_accessor name
100:
101: aliases.unshift name
102: aliases.each do |directive_name|
103: @overridables[directive_name.to_s] = name
104: end
105: end
# File code_objects.rb, line 75
75: def initialize
76: @document_self = true
77: @document_children = true
78: @force_documentation = false
79: @done_documenting = false
80: end
# File doc-tmp/rdoc/code_objects.rb, line 75
75: def initialize
76: @document_self = true
77: @document_children = true
78: @force_documentation = false
79: @done_documenting = false
80: end
Update the comment, but don‘t overwrite a real comment with an empty one
# File doc-tmp/rdoc/code_objects.rb, line 86
86: def comment=(comment)
87: @comment = comment unless comment.empty?
88: end
Update the comment, but don‘t overwrite a real comment with an empty one
# File code_objects.rb, line 86
86: def comment=(comment)
87: @comment = comment unless comment.empty?
88: end
# File doc-tmp/rdoc/code_objects.rb, line 57
57: def document_children=(val)
58: @document_children = val
59: if !val
60: remove_classes_and_modules
61: end
62: end
# File code_objects.rb, line 57
57: def document_children=(val)
58: @document_children = val
59: if !val
60: remove_classes_and_modules
61: end
62: end
# File doc-tmp/rdoc/code_objects.rb, line 34
34: def document_self=(val)
35: @document_self = val
36: if !val
37: remove_methods_etc
38: end
39: end
# File code_objects.rb, line 34
34: def document_self=(val)
35: @document_self = val
36: if !val
37: remove_methods_etc
38: end
39: end
Default callbacks to nothing, but this is overridden for classes and modules
# File code_objects.rb, line 69
69: def remove_classes_and_modules
70: end
Default callbacks to nothing, but this is overridden for classes and modules
# File doc-tmp/rdoc/code_objects.rb, line 69
69: def remove_classes_and_modules
70: end
set and cleared by :startdoc: and :enddoc:, this is used to toggle the capturing of documentation
# File code_objects.rb, line 43
43: def start_doc
44: @document_self = true
45: @document_children = true
46: end
set and cleared by :startdoc: and :enddoc:, this is used to toggle the capturing of documentation
# File doc-tmp/rdoc/code_objects.rb, line 43
43: def start_doc
44: @document_self = true
45: @document_children = true
46: end
# File doc-tmp/rdoc/code_objects.rb, line 48
48: def stop_doc
49: @document_self = false
50: @document_children = false
51: end