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.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +4 -7
- data/LICENSE.rdoc +4 -0
- data/README.md +43 -2
- data/RI.md +75 -75
- data/doc/markup_reference/markdown.md +104 -3
- data/exe/rdoc +2 -2
- data/lib/rdoc/code_object/alias.rb +70 -74
- data/lib/rdoc/code_object/any_method.rb +305 -298
- data/lib/rdoc/code_object/attr.rb +150 -143
- data/lib/rdoc/code_object/class_module.rb +801 -765
- data/lib/rdoc/code_object/constant.rb +178 -150
- data/lib/rdoc/code_object/context/section.rb +133 -160
- data/lib/rdoc/code_object/context.rb +925 -952
- 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 +325 -324
- 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 -213
- data/lib/rdoc/code_object.rb +305 -305
- data/lib/rdoc/comment.rb +274 -337
- data/lib/rdoc/cross_reference.rb +194 -212
- 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 +165 -140
- data/lib/rdoc/generator/darkfish.rb +647 -631
- data/lib/rdoc/generator/json_index.rb +233 -229
- data/lib/rdoc/generator/markup.rb +165 -122
- 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 +538 -0
- data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/_footer.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/_head.rhtml +11 -11
- data/lib/rdoc/generator/template/aliki/_header.rhtml +29 -44
- data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +8 -6
- data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +8 -6
- data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +2 -2
- data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +4 -4
- data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/class.rhtml +56 -46
- data/lib/rdoc/generator/template/aliki/css/rdoc.css +538 -283
- data/lib/rdoc/generator/template/aliki/index.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/js/aliki.js +80 -102
- data/lib/rdoc/generator/template/aliki/page.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +2 -2
- data/lib/rdoc/generator/template/darkfish/_footer.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -6
- data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -6
- data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +5 -5
- data/lib/rdoc/generator/template/darkfish/class.rhtml +18 -21
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +0 -1
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
- 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 +30 -21
- data/lib/rdoc/markdown.rb +329 -151
- data/lib/rdoc/markup/block_quote.rb +12 -8
- data/lib/rdoc/markup/document.rb +127 -123
- data/lib/rdoc/markup/formatter.rb +215 -221
- data/lib/rdoc/markup/heading.rb +1 -4
- 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 +284 -305
- 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 +600 -493
- data/lib/rdoc/markup/to_html_crossref.rb +221 -191
- data/lib/rdoc/markup/to_html_snippet.rb +232 -227
- data/lib/rdoc/markup/to_joined_paragraph.rb +40 -41
- 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 +83 -86
- data/lib/rdoc/markup/verbatim.rb +62 -58
- data/lib/rdoc/markup.rb +198 -196
- data/lib/rdoc/options.rb +1063 -1076
- data/lib/rdoc/parser/c.rb +1039 -1036
- data/lib/rdoc/parser/changelog.rb +319 -315
- data/lib/rdoc/parser/markdown.rb +17 -13
- data/lib/rdoc/parser/rbs.rb +279 -0
- data/lib/rdoc/parser/rd.rb +17 -13
- data/lib/rdoc/parser/ruby.rb +1231 -2222
- data/lib/rdoc/parser/ruby_colorizer.rb +303 -0
- data/lib/rdoc/parser/simple.rb +31 -27
- data/lib/rdoc/parser/text.rb +12 -8
- data/lib/rdoc/parser.rb +230 -221
- data/lib/rdoc/rbs_helper.rb +186 -0
- data/lib/rdoc/rd/inline.rb +57 -53
- data/lib/rdoc/rd.rb +90 -88
- data/lib/rdoc/rdoc.rb +547 -366
- data/lib/rdoc/ri/driver.rb +1141 -1130
- data/lib/rdoc/ri/formatter.rb +7 -3
- data/lib/rdoc/ri/paths.rb +140 -136
- data/lib/rdoc/ri/servlet.rb +456 -0
- data/lib/rdoc/ri/store.rb +4 -2
- data/lib/rdoc/ri/task.rb +55 -51
- data/lib/rdoc/ri.rb +14 -11
- data/lib/rdoc/rubygems_hook.rb +194 -192
- data/lib/rdoc/server.rb +462 -0
- 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 +363 -338
- data/lib/rdoc/store.rb +919 -725
- data/lib/rdoc/task.rb +260 -255
- data/lib/rdoc/text.rb +130 -245
- data/lib/rdoc/token_stream.rb +101 -115
- data/lib/rdoc/tom_doc.rb +203 -201
- data/lib/rdoc/version.rb +1 -1
- data/lib/rdoc.rb +35 -7
- data/lib/rubygems_plugin.rb +2 -11
- data/rdoc-logo.svg +43 -0
- data/rdoc.gemspec +6 -4
- metadata +36 -20
- data/lib/rdoc/code_object/anon_class.rb +0 -10
- data/lib/rdoc/code_object/ghost_method.rb +0 -6
- data/lib/rdoc/code_object/meta_method.rb +0 -6
- data/lib/rdoc/markdown/literals.kpeg +0 -21
- data/lib/rdoc/markdown/literals.rb +0 -454
- data/lib/rdoc/parser/prism_ruby.rb +0 -1112
- data/lib/rdoc/parser/ripper_state_lex.rb +0 -302
- data/lib/rdoc/parser/ruby_tools.rb +0 -163
- data/lib/rdoc/servlet.rb +0 -452
data/lib/rdoc/code_object.rb
CHANGED
|
@@ -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
|
-
#
|
|
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
|
-
|
|
27
|
+
class CodeObject
|
|
37
28
|
|
|
38
|
-
|
|
39
|
-
# Do we document our children?
|
|
29
|
+
include Text
|
|
40
30
|
|
|
41
|
-
|
|
31
|
+
##
|
|
32
|
+
# Our comment
|
|
42
33
|
|
|
43
|
-
|
|
44
|
-
# Do we document ourselves?
|
|
34
|
+
attr_reader :comment
|
|
45
35
|
|
|
46
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
71
|
+
##
|
|
72
|
+
# Sets the parent CodeObject
|
|
82
73
|
|
|
83
|
-
|
|
84
|
-
# Set the section this CodeObject is in
|
|
74
|
+
attr_writer :parent
|
|
85
75
|
|
|
86
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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
|
-
|
|
169
|
-
# has been turned off by :enddoc:
|
|
113
|
+
initialize_visibility
|
|
114
|
+
end
|
|
170
115
|
|
|
171
|
-
|
|
172
|
-
|
|
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
|
-
|
|
175
|
-
|
|
130
|
+
##
|
|
131
|
+
# Replaces our comment with +comment+, unless it is empty.
|
|
176
132
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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
|
-
|
|
187
|
-
|
|
188
|
-
|
|
165
|
+
##
|
|
166
|
+
# Enables or disables documentation of this CodeObject's children unless it
|
|
167
|
+
# has been turned off by :enddoc:
|
|
189
168
|
|
|
190
|
-
|
|
191
|
-
|
|
169
|
+
def document_children=(document_children)
|
|
170
|
+
return unless @track_visibility
|
|
192
171
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
end
|
|
172
|
+
@document_children = document_children unless @done_documenting
|
|
173
|
+
end
|
|
196
174
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
-
|
|
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
|
-
|
|
219
|
-
|
|
184
|
+
@document_self = document_self
|
|
185
|
+
@received_nodoc = true if document_self.nil?
|
|
186
|
+
end
|
|
220
187
|
|
|
221
|
-
|
|
222
|
-
|
|
188
|
+
##
|
|
189
|
+
# Does this object have a comment with content or is #received_nodoc true?
|
|
223
190
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
#--
|
|
228
|
-
# HACK untested, was assigning to an ivar
|
|
191
|
+
def documented?
|
|
192
|
+
@received_nodoc or !@comment.empty?
|
|
193
|
+
end
|
|
229
194
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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
|
-
|
|
236
|
-
|
|
237
|
-
|
|
211
|
+
##
|
|
212
|
+
# File name where this CodeObject was found.
|
|
213
|
+
#
|
|
214
|
+
# See also RDoc::Context#in_files
|
|
238
215
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
end
|
|
216
|
+
def file_name
|
|
217
|
+
return unless @file
|
|
242
218
|
|
|
243
|
-
|
|
244
|
-
|
|
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
|
-
|
|
260
|
-
|
|
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
|
-
|
|
228
|
+
def force_documentation=(value)
|
|
229
|
+
@force_documentation = value unless @done_documenting
|
|
230
|
+
end
|
|
263
231
|
|
|
264
|
-
|
|
265
|
-
|
|
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
|
-
|
|
269
|
-
|
|
270
|
-
# See also #ignore
|
|
237
|
+
def full_name=(full_name)
|
|
238
|
+
@full_name = full_name
|
|
239
|
+
end
|
|
271
240
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
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
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
# This is used by Text#snippet
|
|
265
|
+
##
|
|
266
|
+
# Has this class been ignored?
|
|
267
|
+
#
|
|
268
|
+
# See also #ignore
|
|
281
269
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
270
|
+
def ignored?
|
|
271
|
+
@ignored
|
|
272
|
+
end
|
|
285
273
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
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
|
-
|
|
291
|
-
|
|
292
|
-
|
|
281
|
+
def options
|
|
282
|
+
@store&.options || Options.new
|
|
283
|
+
end
|
|
293
284
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
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
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
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
|
-
|
|
308
|
+
##
|
|
309
|
+
# Name of our parent
|
|
311
310
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
311
|
+
def parent_name
|
|
312
|
+
@parent ? @parent.full_name : '(unknown)'
|
|
313
|
+
end
|
|
315
314
|
|
|
316
|
-
|
|
317
|
-
|
|
315
|
+
##
|
|
316
|
+
# Records the RDoc::TopLevel (file) where this code object was defined
|
|
318
317
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
318
|
+
def record_location(top_level)
|
|
319
|
+
@ignored = false
|
|
320
|
+
@suppressed = false
|
|
321
|
+
@file = top_level
|
|
322
|
+
end
|
|
324
323
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
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
|
-
|
|
330
|
-
|
|
328
|
+
def section
|
|
329
|
+
return @section if @section
|
|
331
330
|
|
|
332
|
-
|
|
333
|
-
|
|
331
|
+
@section = parent.add_section @section_title if parent
|
|
332
|
+
end
|
|
334
333
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
334
|
+
##
|
|
335
|
+
# Enable capture of documentation unless documentation has been
|
|
336
|
+
# turned off by :enddoc:
|
|
338
337
|
|
|
339
|
-
|
|
340
|
-
|
|
338
|
+
def start_doc
|
|
339
|
+
return if @done_documenting
|
|
341
340
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
341
|
+
@document_self = true
|
|
342
|
+
@document_children = true
|
|
343
|
+
@ignored = false
|
|
344
|
+
@suppressed = false
|
|
345
|
+
end
|
|
347
346
|
|
|
348
|
-
|
|
349
|
-
|
|
347
|
+
##
|
|
348
|
+
# Disable capture of documentation
|
|
350
349
|
|
|
351
|
-
|
|
352
|
-
|
|
350
|
+
def stop_doc
|
|
351
|
+
return unless @track_visibility
|
|
353
352
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
353
|
+
@document_self = false
|
|
354
|
+
@document_children = false
|
|
355
|
+
end
|
|
357
356
|
|
|
358
|
-
|
|
359
|
-
|
|
357
|
+
##
|
|
358
|
+
# Sets the +store+ that contains this CodeObject
|
|
360
359
|
|
|
361
|
-
|
|
362
|
-
|
|
360
|
+
def store=(store)
|
|
361
|
+
@store = store
|
|
363
362
|
|
|
364
|
-
|
|
363
|
+
return unless @track_visibility
|
|
365
364
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
365
|
+
if :nodoc == options.visibility
|
|
366
|
+
initialize_visibility
|
|
367
|
+
@track_visibility = false
|
|
368
|
+
end
|
|
369
369
|
end
|
|
370
|
-
end
|
|
371
370
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
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
|
-
|
|
379
|
-
|
|
377
|
+
def suppress
|
|
378
|
+
return unless @track_visibility
|
|
380
379
|
|
|
381
|
-
|
|
380
|
+
@suppressed = true
|
|
382
381
|
|
|
383
|
-
|
|
384
|
-
|
|
382
|
+
stop_doc
|
|
383
|
+
end
|
|
385
384
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
385
|
+
##
|
|
386
|
+
# Has this class been suppressed?
|
|
387
|
+
#
|
|
388
|
+
# See also #suppress
|
|
390
389
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
390
|
+
def suppressed?
|
|
391
|
+
@suppressed
|
|
392
|
+
end
|
|
394
393
|
|
|
394
|
+
end
|
|
395
395
|
end
|