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