rdoc 7.2.0 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +4 -7
  3. data/LICENSE.rdoc +4 -0
  4. data/README.md +43 -2
  5. data/RI.md +75 -75
  6. data/doc/markup_reference/markdown.md +104 -3
  7. data/exe/rdoc +2 -2
  8. data/lib/rdoc/code_object/alias.rb +70 -74
  9. data/lib/rdoc/code_object/any_method.rb +305 -298
  10. data/lib/rdoc/code_object/attr.rb +150 -143
  11. data/lib/rdoc/code_object/class_module.rb +801 -765
  12. data/lib/rdoc/code_object/constant.rb +178 -150
  13. data/lib/rdoc/code_object/context/section.rb +133 -160
  14. data/lib/rdoc/code_object/context.rb +925 -952
  15. data/lib/rdoc/code_object/extend.rb +7 -5
  16. data/lib/rdoc/code_object/include.rb +7 -5
  17. data/lib/rdoc/code_object/method_attr.rb +325 -324
  18. data/lib/rdoc/code_object/mixin.rb +97 -95
  19. data/lib/rdoc/code_object/normal_class.rb +77 -78
  20. data/lib/rdoc/code_object/normal_module.rb +61 -59
  21. data/lib/rdoc/code_object/require.rb +23 -39
  22. data/lib/rdoc/code_object/single_class.rb +21 -19
  23. data/lib/rdoc/code_object/top_level.rb +212 -213
  24. data/lib/rdoc/code_object.rb +305 -305
  25. data/lib/rdoc/comment.rb +274 -337
  26. data/lib/rdoc/cross_reference.rb +194 -212
  27. data/lib/rdoc/encoding.rb +105 -103
  28. data/lib/rdoc/erb_partial.rb +13 -11
  29. data/lib/rdoc/erbio.rb +29 -27
  30. data/lib/rdoc/generator/aliki.rb +165 -140
  31. data/lib/rdoc/generator/darkfish.rb +647 -631
  32. data/lib/rdoc/generator/json_index.rb +233 -229
  33. data/lib/rdoc/generator/markup.rb +165 -122
  34. data/lib/rdoc/generator/pot/message_extractor.rb +57 -51
  35. data/lib/rdoc/generator/pot/po.rb +52 -51
  36. data/lib/rdoc/generator/pot/po_entry.rb +138 -132
  37. data/lib/rdoc/generator/pot.rb +85 -81
  38. data/lib/rdoc/generator/ri.rb +23 -19
  39. data/lib/rdoc/generator/template/aliki/DESIGN.md +538 -0
  40. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +1 -1
  41. data/lib/rdoc/generator/template/aliki/_footer.rhtml +1 -1
  42. data/lib/rdoc/generator/template/aliki/_head.rhtml +11 -11
  43. data/lib/rdoc/generator/template/aliki/_header.rhtml +29 -44
  44. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +8 -6
  45. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +8 -6
  46. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +1 -1
  47. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +2 -2
  48. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +4 -4
  49. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +1 -1
  50. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +1 -1
  51. data/lib/rdoc/generator/template/aliki/class.rhtml +56 -46
  52. data/lib/rdoc/generator/template/aliki/css/rdoc.css +538 -283
  53. data/lib/rdoc/generator/template/aliki/index.rhtml +1 -1
  54. data/lib/rdoc/generator/template/aliki/js/aliki.js +80 -102
  55. data/lib/rdoc/generator/template/aliki/page.rhtml +1 -1
  56. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +1 -1
  57. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +2 -2
  58. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +1 -1
  59. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -6
  60. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -6
  61. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +1 -1
  62. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +1 -1
  63. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +1 -1
  64. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +5 -5
  65. data/lib/rdoc/generator/template/darkfish/class.rhtml +18 -21
  66. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +0 -1
  67. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
  68. data/lib/rdoc/generator.rb +48 -46
  69. data/lib/rdoc/i18n/locale.rb +99 -95
  70. data/lib/rdoc/i18n/text.rb +109 -105
  71. data/lib/rdoc/i18n.rb +7 -5
  72. data/lib/rdoc/markdown/byte_runtime.rb +80 -0
  73. data/lib/rdoc/markdown.kpeg +30 -21
  74. data/lib/rdoc/markdown.rb +329 -151
  75. data/lib/rdoc/markup/block_quote.rb +12 -8
  76. data/lib/rdoc/markup/document.rb +127 -123
  77. data/lib/rdoc/markup/formatter.rb +215 -221
  78. data/lib/rdoc/markup/heading.rb +1 -4
  79. data/lib/rdoc/markup/include.rb +33 -29
  80. data/lib/rdoc/markup/indented_paragraph.rb +37 -33
  81. data/lib/rdoc/markup/inline_parser.rb +281 -277
  82. data/lib/rdoc/markup/list.rb +80 -88
  83. data/lib/rdoc/markup/list_item.rb +73 -85
  84. data/lib/rdoc/markup/paragraph.rb +23 -19
  85. data/lib/rdoc/markup/parser.rb +501 -497
  86. data/lib/rdoc/markup/pre_process.rb +284 -305
  87. data/lib/rdoc/markup/raw.rb +2 -2
  88. data/lib/rdoc/markup/rule.rb +16 -12
  89. data/lib/rdoc/markup/to_ansi.rb +143 -139
  90. data/lib/rdoc/markup/to_bs.rb +72 -68
  91. data/lib/rdoc/markup/to_html.rb +600 -493
  92. data/lib/rdoc/markup/to_html_crossref.rb +221 -191
  93. data/lib/rdoc/markup/to_html_snippet.rb +232 -227
  94. data/lib/rdoc/markup/to_joined_paragraph.rb +40 -41
  95. data/lib/rdoc/markup/to_label.rb +63 -59
  96. data/lib/rdoc/markup/to_markdown.rb +212 -208
  97. data/lib/rdoc/markup/to_rdoc.rb +336 -332
  98. data/lib/rdoc/markup/to_table_of_contents.rb +66 -62
  99. data/lib/rdoc/markup/to_test.rb +60 -56
  100. data/lib/rdoc/markup/to_tt_only.rb +83 -86
  101. data/lib/rdoc/markup/verbatim.rb +62 -58
  102. data/lib/rdoc/markup.rb +198 -196
  103. data/lib/rdoc/options.rb +1063 -1076
  104. data/lib/rdoc/parser/c.rb +1039 -1036
  105. data/lib/rdoc/parser/changelog.rb +319 -315
  106. data/lib/rdoc/parser/markdown.rb +17 -13
  107. data/lib/rdoc/parser/rbs.rb +279 -0
  108. data/lib/rdoc/parser/rd.rb +17 -13
  109. data/lib/rdoc/parser/ruby.rb +1231 -2222
  110. data/lib/rdoc/parser/ruby_colorizer.rb +303 -0
  111. data/lib/rdoc/parser/simple.rb +31 -27
  112. data/lib/rdoc/parser/text.rb +12 -8
  113. data/lib/rdoc/parser.rb +230 -221
  114. data/lib/rdoc/rbs_helper.rb +186 -0
  115. data/lib/rdoc/rd/inline.rb +57 -53
  116. data/lib/rdoc/rd.rb +90 -88
  117. data/lib/rdoc/rdoc.rb +547 -366
  118. data/lib/rdoc/ri/driver.rb +1141 -1130
  119. data/lib/rdoc/ri/formatter.rb +7 -3
  120. data/lib/rdoc/ri/paths.rb +140 -136
  121. data/lib/rdoc/ri/servlet.rb +456 -0
  122. data/lib/rdoc/ri/store.rb +4 -2
  123. data/lib/rdoc/ri/task.rb +55 -51
  124. data/lib/rdoc/ri.rb +14 -11
  125. data/lib/rdoc/rubygems_hook.rb +194 -192
  126. data/lib/rdoc/server.rb +462 -0
  127. data/lib/rdoc/stats/normal.rb +46 -42
  128. data/lib/rdoc/stats/quiet.rb +39 -35
  129. data/lib/rdoc/stats/verbose.rb +35 -31
  130. data/lib/rdoc/stats.rb +363 -338
  131. data/lib/rdoc/store.rb +919 -725
  132. data/lib/rdoc/task.rb +260 -255
  133. data/lib/rdoc/text.rb +130 -245
  134. data/lib/rdoc/token_stream.rb +101 -115
  135. data/lib/rdoc/tom_doc.rb +203 -201
  136. data/lib/rdoc/version.rb +1 -1
  137. data/lib/rdoc.rb +35 -7
  138. data/lib/rubygems_plugin.rb +2 -11
  139. data/rdoc-logo.svg +43 -0
  140. data/rdoc.gemspec +6 -4
  141. metadata +36 -20
  142. data/lib/rdoc/code_object/anon_class.rb +0 -10
  143. data/lib/rdoc/code_object/ghost_method.rb +0 -6
  144. data/lib/rdoc/code_object/meta_method.rb +0 -6
  145. data/lib/rdoc/markdown/literals.kpeg +0 -21
  146. data/lib/rdoc/markdown/literals.rb +0 -454
  147. data/lib/rdoc/parser/prism_ruby.rb +0 -1112
  148. data/lib/rdoc/parser/ripper_state_lex.rb +0 -302
  149. data/lib/rdoc/parser/ruby_tools.rb +0 -163
  150. data/lib/rdoc/servlet.rb +0 -452
@@ -1,395 +1,395 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # Base class for the RDoc code tree.
4
- #
5
- # We contain the common stuff for contexts (which are containers) and other
6
- # elements (methods, attributes and so on)
7
- #
8
- # Here's the tree of the CodeObject subclasses:
9
- #
10
- # * RDoc::Context
11
- # * RDoc::TopLevel
12
- # * RDoc::ClassModule
13
- # * RDoc::AnonClass (never used so far)
14
- # * RDoc::NormalClass
15
- # * RDoc::NormalModule
16
- # * RDoc::SingleClass
17
- # * RDoc::MethodAttr
18
- # * RDoc::Attr
19
- # * RDoc::AnyMethod
20
- # * RDoc::GhostMethod
21
- # * RDoc::MetaMethod
22
- # * RDoc::Alias
23
- # * RDoc::Constant
24
- # * RDoc::Require
25
- # * RDoc::Mixin
26
- # * RDoc::Include
27
- # * RDoc::Extend
28
-
29
- class RDoc::CodeObject
30
-
31
- include RDoc::Text
32
-
2
+ module RDoc
33
3
  ##
34
- # Our comment
4
+ # Base class for the RDoc code tree.
5
+ #
6
+ # We contain the common stuff for contexts (which are containers) and other
7
+ # elements (methods, attributes and so on)
8
+ #
9
+ # Here's the tree of the CodeObject subclasses:
10
+ #
11
+ # * RDoc::Context
12
+ # * RDoc::TopLevel
13
+ # * RDoc::ClassModule
14
+ # * RDoc::NormalClass
15
+ # * RDoc::NormalModule
16
+ # * RDoc::SingleClass
17
+ # * RDoc::MethodAttr
18
+ # * RDoc::Attr
19
+ # * RDoc::AnyMethod
20
+ # * RDoc::Alias
21
+ # * RDoc::Constant
22
+ # * RDoc::Require
23
+ # * RDoc::Mixin
24
+ # * RDoc::Include
25
+ # * RDoc::Extend
35
26
 
36
- attr_reader :comment
27
+ class CodeObject
37
28
 
38
- ##
39
- # Do we document our children?
29
+ include Text
40
30
 
41
- attr_reader :document_children
31
+ ##
32
+ # Our comment
42
33
 
43
- ##
44
- # Do we document ourselves?
34
+ attr_reader :comment
45
35
 
46
- attr_reader :document_self
36
+ ##
37
+ # Do we document our children?
47
38
 
48
- ##
49
- # Are we done documenting (ie, did we come across a :enddoc:)?
39
+ attr_reader :document_children
50
40
 
51
- attr_reader :done_documenting
41
+ ##
42
+ # Do we document ourselves?
52
43
 
53
- ##
54
- # Which file this code object was defined in
44
+ attr_reader :document_self
55
45
 
56
- attr_reader :file
46
+ ##
47
+ # Are we done documenting (ie, did we come across a :enddoc:)?
57
48
 
58
- ##
59
- # Force documentation of this CodeObject
49
+ attr_reader :done_documenting
60
50
 
61
- attr_reader :force_documentation
51
+ ##
52
+ # Which file this code object was defined in
62
53
 
63
- ##
64
- # Line in #file where this CodeObject was defined
54
+ attr_reader :file
65
55
 
66
- attr_accessor :line
56
+ ##
57
+ # Force documentation of this CodeObject
67
58
 
68
- ##
69
- # Hash of arbitrary metadata for this CodeObject
59
+ attr_reader :force_documentation
70
60
 
71
- attr_reader :metadata
61
+ ##
62
+ # Line in #file where this CodeObject was defined
72
63
 
73
- ##
74
- # Sets the parent CodeObject
64
+ attr_accessor :line
75
65
 
76
- attr_writer :parent
66
+ ##
67
+ # Hash of arbitrary metadata for this CodeObject
77
68
 
78
- ##
79
- # Did we ever receive a +:nodoc:+ directive?
69
+ attr_reader :metadata
80
70
 
81
- attr_reader :received_nodoc
71
+ ##
72
+ # Sets the parent CodeObject
82
73
 
83
- ##
84
- # Set the section this CodeObject is in
74
+ attr_writer :parent
85
75
 
86
- attr_writer :section
76
+ ##
77
+ # Did we ever receive a +:nodoc:+ directive?
87
78
 
88
- ##
89
- # The RDoc::Store for this object.
79
+ attr_reader :received_nodoc
90
80
 
91
- attr_reader :store
81
+ ##
82
+ # Set the section this CodeObject is in
92
83
 
93
- ##
94
- # When mixed-in to a class, this points to the Context in which it was originally defined.
84
+ attr_writer :section
95
85
 
96
- attr_accessor :mixin_from
86
+ ##
87
+ # The RDoc::Store for this object.
97
88
 
98
- ##
99
- # Creates a new CodeObject that will document itself and its children
100
-
101
- def initialize
102
- @metadata = {}
103
- @comment = ''
104
- @parent = nil
105
- @parent_name = nil # for loading
106
- @parent_class = nil # for loading
107
- @section = nil
108
- @section_title = nil # for loading
109
- @file = nil
110
- @full_name = nil
111
- @store = nil
112
- @track_visibility = true
113
- @mixin_from = nil
114
-
115
- initialize_visibility
116
- end
89
+ attr_reader :store
117
90
 
118
- ##
119
- # Initializes state for visibility of this CodeObject and its children.
120
-
121
- def initialize_visibility # :nodoc:
122
- @document_children = true
123
- @document_self = true
124
- @done_documenting = false
125
- @force_documentation = false
126
- @received_nodoc = false
127
- @ignored = false
128
- @suppressed = false
129
- @track_visibility = true
130
- end
91
+ ##
92
+ # When mixed-in to a class, this points to the Context in which it was originally defined.
131
93
 
132
- ##
133
- # Replaces our comment with +comment+, unless it is empty.
134
-
135
- def comment=(comment)
136
- @comment = case comment
137
- when NilClass then ''
138
- when RDoc::Comment then comment.normalize
139
- else
140
- if comment and not comment.empty? then
141
- normalize_comment comment
142
- else
143
- # HACK correct fix is to have #initialize create @comment
144
- # with the correct encoding
145
- if String === @comment and @comment.empty? then
146
- @comment = RDoc::Encoding.change_encoding @comment, comment.encoding
147
- end
148
- @comment
149
- end
150
- end
151
- end
94
+ attr_accessor :mixin_from
152
95
 
153
- ##
154
- # Should this CodeObject be displayed in output?
155
- #
156
- # A code object should be displayed if:
157
- #
158
- # * The item didn't have a nodoc or wasn't in a container that had nodoc
159
- # * The item wasn't ignored
160
- # * The item has documentation and was not suppressed
96
+ ##
97
+ # Creates a new CodeObject that will document itself and its children
161
98
 
162
- def display?
163
- @document_self and not @ignored and
164
- (documented? or not @suppressed)
165
- end
99
+ def initialize
100
+ @metadata = {}
101
+ @comment = ''
102
+ @parent = nil
103
+ @parent_name = nil # for loading
104
+ @parent_class = nil # for loading
105
+ @section = nil
106
+ @section_title = nil # for loading
107
+ @file = nil
108
+ @full_name = nil
109
+ @store = nil
110
+ @track_visibility = true
111
+ @mixin_from = nil
166
112
 
167
- ##
168
- # Enables or disables documentation of this CodeObject's children unless it
169
- # has been turned off by :enddoc:
113
+ initialize_visibility
114
+ end
170
115
 
171
- def document_children=(document_children)
172
- return unless @track_visibility
116
+ ##
117
+ # Initializes state for visibility of this CodeObject and its children.
118
+
119
+ def initialize_visibility # :nodoc:
120
+ @document_children = true
121
+ @document_self = true
122
+ @done_documenting = false
123
+ @force_documentation = false
124
+ @received_nodoc = false
125
+ @ignored = false
126
+ @suppressed = false
127
+ @track_visibility = true
128
+ end
173
129
 
174
- @document_children = document_children unless @done_documenting
175
- end
130
+ ##
131
+ # Replaces our comment with +comment+, unless it is empty.
176
132
 
177
- ##
178
- # Enables or disables documentation of this CodeObject unless it has been
179
- # turned off by :enddoc:. If the argument is +nil+ it means the
180
- # documentation is turned off by +:nodoc:+.
133
+ def comment=(comment)
134
+ @comment = case comment
135
+ when NilClass then ''
136
+ when Comment then comment.normalize
137
+ else
138
+ if comment and not comment.empty?
139
+ normalize_comment comment
140
+ else
141
+ # HACK correct fix is to have #initialize create @comment
142
+ # with the correct encoding
143
+ if String === @comment and @comment.empty?
144
+ @comment = Encoding.change_encoding @comment, comment.encoding
145
+ end
146
+ @comment
147
+ end
148
+ end
149
+ end
181
150
 
182
- def document_self=(document_self)
183
- return unless @track_visibility
184
- return if @done_documenting
151
+ ##
152
+ # Should this CodeObject be displayed in output?
153
+ #
154
+ # A code object should be displayed if:
155
+ #
156
+ # * The item didn't have a nodoc or wasn't in a container that had nodoc
157
+ # * The item wasn't ignored
158
+ # * The item has documentation and was not suppressed
159
+
160
+ def display?
161
+ @document_self and not @ignored and
162
+ (documented? or not @suppressed)
163
+ end
185
164
 
186
- @document_self = document_self
187
- @received_nodoc = true if document_self.nil?
188
- end
165
+ ##
166
+ # Enables or disables documentation of this CodeObject's children unless it
167
+ # has been turned off by :enddoc:
189
168
 
190
- ##
191
- # Does this object have a comment with content or is #received_nodoc true?
169
+ def document_children=(document_children)
170
+ return unless @track_visibility
192
171
 
193
- def documented?
194
- @received_nodoc or !@comment.empty?
195
- end
172
+ @document_children = document_children unless @done_documenting
173
+ end
196
174
 
197
- ##
198
- # Turns documentation on/off, and turns on/off #document_self
199
- # and #document_children.
200
- #
201
- # Once documentation has been turned off (by +:enddoc:+),
202
- # the object will refuse to turn #document_self or
203
- # #document_children on, so +:doc:+ and +:start_doc:+ directives
204
- # will have no effect in the current file.
205
-
206
- def done_documenting=(value)
207
- return unless @track_visibility
208
- @done_documenting = value
209
- @document_self = !value
210
- @document_children = @document_self
211
- end
175
+ ##
176
+ # Enables or disables documentation of this CodeObject unless it has been
177
+ # turned off by :enddoc:. If the argument is +nil+ it means the
178
+ # documentation is turned off by +:nodoc:+.
212
179
 
213
- ##
214
- # File name where this CodeObject was found.
215
- #
216
- # See also RDoc::Context#in_files
180
+ def document_self=(document_self)
181
+ return unless @track_visibility
182
+ return if @done_documenting
217
183
 
218
- def file_name
219
- return unless @file
184
+ @document_self = document_self
185
+ @received_nodoc = true if document_self.nil?
186
+ end
220
187
 
221
- @file.absolute_name
222
- end
188
+ ##
189
+ # Does this object have a comment with content or is #received_nodoc true?
223
190
 
224
- ##
225
- # Force the documentation of this object unless documentation
226
- # has been turned off by :enddoc:
227
- #--
228
- # HACK untested, was assigning to an ivar
191
+ def documented?
192
+ @received_nodoc or !@comment.empty?
193
+ end
229
194
 
230
- def force_documentation=(value)
231
- @force_documentation = value unless @done_documenting
232
- end
195
+ ##
196
+ # Turns documentation on/off, and turns on/off #document_self
197
+ # and #document_children.
198
+ #
199
+ # Once documentation has been turned off (by +:enddoc:+),
200
+ # the object will refuse to turn #document_self or
201
+ # #document_children on, so +:doc:+ and +:start_doc:+ directives
202
+ # will have no effect in the current file.
203
+
204
+ def done_documenting=(value)
205
+ return unless @track_visibility
206
+ @done_documenting = value
207
+ @document_self = !value
208
+ @document_children = @document_self
209
+ end
233
210
 
234
- ##
235
- # Sets the full_name overriding any computed full name.
236
- #
237
- # Set to +nil+ to clear RDoc's cached value
211
+ ##
212
+ # File name where this CodeObject was found.
213
+ #
214
+ # See also RDoc::Context#in_files
238
215
 
239
- def full_name=(full_name)
240
- @full_name = full_name
241
- end
216
+ def file_name
217
+ return unless @file
242
218
 
243
- ##
244
- # Use this to ignore a CodeObject and all its children until found again
245
- # (#record_location is called). An ignored item will not be displayed in
246
- # documentation.
247
- #
248
- # See github issue #55
249
- #
250
- # The ignored status is temporary in order to allow implementation details
251
- # to be hidden. At the end of processing a file RDoc allows all classes
252
- # and modules to add new documentation to previously created classes.
253
- #
254
- # If a class was ignored (via stopdoc) then reopened later with additional
255
- # documentation it should be displayed. If a class was ignored and never
256
- # reopened it should not be displayed. The ignore flag allows this to
257
- # occur.
219
+ @file.absolute_name
220
+ end
258
221
 
259
- def ignore
260
- return unless @track_visibility
222
+ ##
223
+ # Force the documentation of this object unless documentation
224
+ # has been turned off by :enddoc:
225
+ #--
226
+ # HACK untested, was assigning to an ivar
261
227
 
262
- @ignored = true
228
+ def force_documentation=(value)
229
+ @force_documentation = value unless @done_documenting
230
+ end
263
231
 
264
- stop_doc
265
- end
232
+ ##
233
+ # Sets the full_name overriding any computed full name.
234
+ #
235
+ # Set to +nil+ to clear RDoc's cached value
266
236
 
267
- ##
268
- # Has this class been ignored?
269
- #
270
- # See also #ignore
237
+ def full_name=(full_name)
238
+ @full_name = full_name
239
+ end
271
240
 
272
- def ignored?
273
- @ignored
274
- end
241
+ ##
242
+ # Use this to ignore a CodeObject and all its children until found again
243
+ # (#record_location is called). An ignored item will not be displayed in
244
+ # documentation.
245
+ #
246
+ # See github issue #55
247
+ #
248
+ # The ignored status is temporary in order to allow implementation details
249
+ # to be hidden. At the end of processing a file RDoc allows all classes
250
+ # and modules to add new documentation to previously created classes.
251
+ #
252
+ # If a class was ignored (via stopdoc) then reopened later with additional
253
+ # documentation it should be displayed. If a class was ignored and never
254
+ # reopened it should not be displayed. The ignore flag allows this to
255
+ # occur.
256
+
257
+ def ignore
258
+ return unless @track_visibility
259
+
260
+ @ignored = true
261
+
262
+ stop_doc
263
+ end
275
264
 
276
- ##
277
- # The options instance from the store this CodeObject is attached to, or a
278
- # default options instance if the CodeObject is not attached.
279
- #
280
- # This is used by Text#snippet
265
+ ##
266
+ # Has this class been ignored?
267
+ #
268
+ # See also #ignore
281
269
 
282
- def options
283
- @store&.options || RDoc::Options.new
284
- end
270
+ def ignored?
271
+ @ignored
272
+ end
285
273
 
286
- ##
287
- # Our parent CodeObject. The parent may be missing for classes loaded from
288
- # legacy RI data stores.
274
+ ##
275
+ # The options instance from the store this CodeObject is attached to, or a
276
+ # default options instance if the CodeObject is not attached.
277
+ #
278
+ # Used by: store= (visibility check), ClassModule#path, TopLevel#path,
279
+ # ClassModule#embed_mixins
289
280
 
290
- def parent
291
- return @parent if @parent
292
- return nil unless @parent_name
281
+ def options
282
+ @store&.options || Options.new
283
+ end
293
284
 
294
- if @parent_class == RDoc::TopLevel then
295
- @parent = @store.add_file @parent_name
296
- else
297
- @parent = @store.find_class_or_module @parent_name
285
+ ##
286
+ # Our parent CodeObject. The parent may be missing for classes loaded from
287
+ # legacy RI data stores.
298
288
 
289
+ def parent
299
290
  return @parent if @parent
291
+ return nil unless @parent_name
292
+
293
+ if @parent_class == TopLevel
294
+ @parent = @store.add_file @parent_name
295
+ else
296
+ @parent = @store.find_class_or_module @parent_name
300
297
 
301
- begin
302
- @parent = @store.load_class @parent_name
303
- rescue RDoc::Store::MissingFileError
304
- nil
298
+ return @parent if @parent
299
+
300
+ begin
301
+ @parent = @store.load_class @parent_name
302
+ rescue Store::MissingFileError
303
+ nil
304
+ end
305
305
  end
306
306
  end
307
- end
308
307
 
309
- ##
310
- # Name of our parent
308
+ ##
309
+ # Name of our parent
311
310
 
312
- def parent_name
313
- @parent ? @parent.full_name : '(unknown)'
314
- end
311
+ def parent_name
312
+ @parent ? @parent.full_name : '(unknown)'
313
+ end
315
314
 
316
- ##
317
- # Records the RDoc::TopLevel (file) where this code object was defined
315
+ ##
316
+ # Records the RDoc::TopLevel (file) where this code object was defined
318
317
 
319
- def record_location(top_level)
320
- @ignored = false
321
- @suppressed = false
322
- @file = top_level
323
- end
318
+ def record_location(top_level)
319
+ @ignored = false
320
+ @suppressed = false
321
+ @file = top_level
322
+ end
324
323
 
325
- ##
326
- # The section this CodeObject is in. Sections allow grouping of constants,
327
- # attributes and methods inside a class or module.
324
+ ##
325
+ # The section this CodeObject is in. Sections allow grouping of constants,
326
+ # attributes and methods inside a class or module.
328
327
 
329
- def section
330
- return @section if @section
328
+ def section
329
+ return @section if @section
331
330
 
332
- @section = parent.add_section @section_title if parent
333
- end
331
+ @section = parent.add_section @section_title if parent
332
+ end
334
333
 
335
- ##
336
- # Enable capture of documentation unless documentation has been
337
- # turned off by :enddoc:
334
+ ##
335
+ # Enable capture of documentation unless documentation has been
336
+ # turned off by :enddoc:
338
337
 
339
- def start_doc
340
- return if @done_documenting
338
+ def start_doc
339
+ return if @done_documenting
341
340
 
342
- @document_self = true
343
- @document_children = true
344
- @ignored = false
345
- @suppressed = false
346
- end
341
+ @document_self = true
342
+ @document_children = true
343
+ @ignored = false
344
+ @suppressed = false
345
+ end
347
346
 
348
- ##
349
- # Disable capture of documentation
347
+ ##
348
+ # Disable capture of documentation
350
349
 
351
- def stop_doc
352
- return unless @track_visibility
350
+ def stop_doc
351
+ return unless @track_visibility
353
352
 
354
- @document_self = false
355
- @document_children = false
356
- end
353
+ @document_self = false
354
+ @document_children = false
355
+ end
357
356
 
358
- ##
359
- # Sets the +store+ that contains this CodeObject
357
+ ##
358
+ # Sets the +store+ that contains this CodeObject
360
359
 
361
- def store=(store)
362
- @store = store
360
+ def store=(store)
361
+ @store = store
363
362
 
364
- return unless @track_visibility
363
+ return unless @track_visibility
365
364
 
366
- if :nodoc == options.visibility then
367
- initialize_visibility
368
- @track_visibility = false
365
+ if :nodoc == options.visibility
366
+ initialize_visibility
367
+ @track_visibility = false
368
+ end
369
369
  end
370
- end
371
370
 
372
- ##
373
- # Use this to suppress a CodeObject and all its children until the next file
374
- # it is seen in or documentation is discovered. A suppressed item with
375
- # documentation will be displayed while an ignored item with documentation
376
- # may not be displayed.
371
+ ##
372
+ # Use this to suppress a CodeObject and all its children until the next file
373
+ # it is seen in or documentation is discovered. A suppressed item with
374
+ # documentation will be displayed while an ignored item with documentation
375
+ # may not be displayed.
377
376
 
378
- def suppress
379
- return unless @track_visibility
377
+ def suppress
378
+ return unless @track_visibility
380
379
 
381
- @suppressed = true
380
+ @suppressed = true
382
381
 
383
- stop_doc
384
- end
382
+ stop_doc
383
+ end
385
384
 
386
- ##
387
- # Has this class been suppressed?
388
- #
389
- # See also #suppress
385
+ ##
386
+ # Has this class been suppressed?
387
+ #
388
+ # See also #suppress
390
389
 
391
- def suppressed?
392
- @suppressed
393
- end
390
+ def suppressed?
391
+ @suppressed
392
+ end
394
393
 
394
+ end
395
395
  end