rdoc 6.3.4.1 → 8.0.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 +195 -0
- data/History.rdoc +65 -63
- data/LEGAL.rdoc +7 -1
- data/LICENSE.rdoc +6 -0
- data/README.md +236 -0
- data/RI.md +842 -0
- data/TODO.rdoc +8 -7
- data/doc/markup_reference/markdown.md +659 -0
- data/doc/markup_reference/rdoc.rdoc +1169 -0
- data/exe/rdoc +0 -1
- data/lib/rdoc/{alias.rb → code_object/alias.rb} +4 -18
- data/lib/rdoc/{any_method.rb → code_object/any_method.rb} +50 -24
- data/lib/rdoc/{attr.rb → code_object/attr.rb} +16 -14
- data/lib/rdoc/{class_module.rb → code_object/class_module.rb} +225 -58
- data/lib/rdoc/{constant.rb → code_object/constant.rb} +44 -10
- data/lib/rdoc/code_object/context/section.rb +182 -0
- data/lib/rdoc/{context.rb → code_object/context.rb} +78 -106
- data/lib/rdoc/{extend.rb → code_object/extend.rb} +0 -1
- data/lib/rdoc/{include.rb → code_object/include.rb} +0 -1
- data/lib/rdoc/{method_attr.rb → code_object/method_attr.rb} +46 -48
- data/lib/rdoc/{mixin.rb → code_object/mixin.rb} +6 -4
- data/lib/rdoc/{normal_class.rb → code_object/normal_class.rb} +2 -3
- data/lib/rdoc/{normal_module.rb → code_object/normal_module.rb} +2 -3
- data/lib/rdoc/{require.rb → code_object/require.rb} +1 -2
- data/lib/rdoc/{single_class.rb → code_object/single_class.rb} +5 -1
- data/lib/rdoc/{top_level.rb → code_object/top_level.rb} +60 -63
- data/lib/rdoc/code_object.rb +11 -39
- data/lib/rdoc/code_objects.rb +1 -2
- data/lib/rdoc/comment.rb +202 -99
- data/lib/rdoc/cross_reference.rb +75 -62
- data/lib/rdoc/encoding.rb +8 -24
- data/lib/rdoc/erb_partial.rb +1 -2
- data/lib/rdoc/erbio.rb +3 -8
- data/lib/rdoc/generator/aliki.rb +200 -0
- data/lib/rdoc/generator/darkfish.rb +156 -122
- data/lib/rdoc/generator/json_index.rb +8 -24
- data/lib/rdoc/generator/markup.rb +70 -34
- data/lib/rdoc/generator/pot/message_extractor.rb +7 -7
- data/lib/rdoc/generator/pot/po.rb +1 -1
- data/lib/rdoc/generator/pot/po_entry.rb +8 -8
- data/lib/rdoc/generator/pot.rb +1 -5
- data/lib/rdoc/generator/ri.rb +1 -2
- data/lib/rdoc/generator/template/aliki/DESIGN.md +536 -0
- data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
- data/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
- data/lib/rdoc/generator/template/aliki/_head.rhtml +163 -0
- data/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
- data/lib/rdoc/generator/template/aliki/_icons.rhtml +208 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +27 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +27 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
- data/lib/rdoc/generator/template/aliki/class.rhtml +230 -0
- data/lib/rdoc/generator/template/aliki/css/rdoc.css +2181 -0
- data/lib/rdoc/generator/template/aliki/index.rhtml +22 -0
- data/lib/rdoc/generator/template/aliki/js/aliki.js +513 -0
- data/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
- data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
- data/lib/rdoc/generator/template/aliki/js/search_controller.js +129 -0
- data/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
- data/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
- data/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
- data/lib/rdoc/generator/template/aliki/page.rhtml +18 -0
- data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
- data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
- data/lib/rdoc/generator/template/darkfish/_footer.rhtml +3 -3
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +35 -14
- data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +11 -9
- data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +11 -9
- data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +7 -6
- data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +20 -11
- data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +25 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +4 -9
- data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +2 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +4 -4
- data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +28 -7
- data/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
- data/lib/rdoc/generator/template/darkfish/class.rhtml +138 -90
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +420 -358
- data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/index.rhtml +14 -12
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +59 -3
- data/lib/rdoc/generator/template/darkfish/js/search.js +15 -5
- data/lib/rdoc/generator/template/darkfish/page.rhtml +7 -6
- data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +12 -9
- data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +24 -21
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +35 -21
- data/lib/rdoc/generator/template/json_index/js/navigation.js +8 -8
- data/lib/rdoc/generator/template/json_index/js/searcher.js +48 -6
- data/lib/rdoc/generator.rb +6 -5
- data/lib/rdoc/i18n/text.rb +3 -3
- data/lib/rdoc/i18n.rb +1 -1
- data/lib/rdoc/known_classes.rb +5 -4
- data/lib/rdoc/markdown/entities.rb +0 -1
- data/lib/rdoc/markdown/literals.kpeg +0 -2
- data/lib/rdoc/markdown/literals.rb +0 -1
- data/lib/rdoc/markdown.kpeg +140 -62
- data/lib/rdoc/markdown.rb +1015 -873
- data/lib/rdoc/markup/blank_line.rb +25 -24
- data/lib/rdoc/markup/block_quote.rb +1 -2
- data/lib/rdoc/markup/document.rb +10 -11
- data/lib/rdoc/markup/element.rb +21 -0
- data/lib/rdoc/markup/formatter.rb +134 -115
- data/lib/rdoc/markup/hard_break.rb +30 -28
- data/lib/rdoc/markup/heading.rb +163 -72
- data/lib/rdoc/markup/include.rb +3 -4
- data/lib/rdoc/markup/indented_paragraph.rb +4 -5
- data/lib/rdoc/markup/inline_parser.rb +312 -0
- data/lib/rdoc/markup/list.rb +6 -7
- data/lib/rdoc/markup/list_item.rb +6 -7
- data/lib/rdoc/markup/paragraph.rb +2 -3
- data/lib/rdoc/markup/parser.rb +29 -19
- data/lib/rdoc/markup/pre_process.rb +39 -18
- data/lib/rdoc/markup/raw.rb +52 -56
- data/lib/rdoc/markup/rule.rb +2 -3
- data/lib/rdoc/markup/table.rb +49 -32
- data/lib/rdoc/markup/to_ansi.rb +58 -8
- data/lib/rdoc/markup/to_bs.rb +47 -38
- data/lib/rdoc/markup/to_html.rb +343 -105
- data/lib/rdoc/markup/to_html_crossref.rb +143 -58
- data/lib/rdoc/markup/to_html_snippet.rb +78 -76
- data/lib/rdoc/markup/to_joined_paragraph.rb +3 -9
- data/lib/rdoc/markup/to_label.rb +34 -25
- data/lib/rdoc/markup/to_markdown.rb +74 -51
- data/lib/rdoc/markup/to_rdoc.rb +141 -82
- data/lib/rdoc/markup/to_table_of_contents.rb +4 -5
- data/lib/rdoc/markup/to_test.rb +10 -3
- data/lib/rdoc/markup/to_tt_only.rb +17 -31
- data/lib/rdoc/markup/verbatim.rb +5 -6
- data/lib/rdoc/markup.rb +59 -707
- data/lib/rdoc/options.rb +228 -101
- data/lib/rdoc/parser/c.rb +186 -184
- data/lib/rdoc/parser/changelog.rb +57 -13
- data/lib/rdoc/parser/markdown.rb +0 -2
- data/lib/rdoc/parser/rbs.rb +275 -0
- data/lib/rdoc/parser/rd.rb +0 -1
- data/lib/rdoc/parser/ruby.rb +963 -2024
- data/lib/rdoc/parser/ruby_colorizer.rb +253 -0
- data/lib/rdoc/parser/simple.rb +6 -23
- data/lib/rdoc/parser/text.rb +0 -1
- data/lib/rdoc/parser.rb +35 -14
- data/lib/rdoc/rbs_helper.rb +186 -0
- data/lib/rdoc/rd/block_parser.rb +659 -11
- data/lib/rdoc/rd/block_parser.ry +13 -9
- data/lib/rdoc/rd/inline.rb +4 -5
- data/lib/rdoc/rd/inline_parser.rb +646 -2
- data/lib/rdoc/rd.rb +4 -5
- data/lib/rdoc/rdoc.rb +234 -90
- data/lib/rdoc/ri/driver.rb +172 -172
- data/lib/rdoc/ri/paths.rb +3 -3
- data/lib/rdoc/{servlet.rb → ri/servlet.rb} +28 -27
- data/lib/rdoc/ri/store.rb +0 -1
- data/lib/rdoc/ri/task.rb +3 -3
- data/lib/rdoc/ri.rb +5 -5
- data/lib/rdoc/rubygems_hook.rb +106 -25
- data/lib/rdoc/server.rb +460 -0
- data/lib/rdoc/stats/normal.rb +1 -1
- data/lib/rdoc/stats/quiet.rb +1 -2
- data/lib/rdoc/stats/verbose.rb +3 -5
- data/lib/rdoc/stats.rb +158 -136
- data/lib/rdoc/store.rb +267 -48
- data/lib/rdoc/task.rb +54 -28
- data/lib/rdoc/text.rb +60 -120
- data/lib/rdoc/token_stream.rb +30 -45
- data/lib/rdoc/tom_doc.rb +9 -15
- data/lib/rdoc/version.rb +3 -1
- data/lib/rdoc.rb +90 -52
- data/lib/rubygems_plugin.rb +14 -0
- data/man/ri.1 +2 -0
- data/rdoc-logo.svg +43 -0
- data/rdoc.gemspec +25 -200
- metadata +120 -53
- data/CONTRIBUTING.rdoc +0 -220
- data/ExampleMarkdown.md +0 -37
- data/ExampleRDoc.rdoc +0 -208
- data/Gemfile +0 -12
- data/README.rdoc +0 -129
- data/RI.rdoc +0 -57
- data/Rakefile +0 -101
- data/bin/console +0 -7
- data/bin/setup +0 -6
- data/lib/rdoc/anon_class.rb +0 -11
- data/lib/rdoc/context/section.rb +0 -232
- data/lib/rdoc/generator/template/darkfish/.document +0 -0
- data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
- data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
- data/lib/rdoc/generator/template/json_index/.document +0 -1
- data/lib/rdoc/ghost_method.rb +0 -7
- data/lib/rdoc/markup/attr_changer.rb +0 -23
- data/lib/rdoc/markup/attr_span.rb +0 -36
- data/lib/rdoc/markup/attribute_manager.rb +0 -409
- data/lib/rdoc/markup/attributes.rb +0 -71
- data/lib/rdoc/markup/regexp_handling.rb +0 -41
- data/lib/rdoc/meta_method.rb +0 -7
- data/lib/rdoc/parser/ripper_state_lex.rb +0 -590
- data/lib/rdoc/parser/ruby_tools.rb +0 -167
data/exe/rdoc
CHANGED
|
@@ -23,21 +23,15 @@ class RDoc::Alias < RDoc::CodeObject
|
|
|
23
23
|
##
|
|
24
24
|
# Is this an alias declared in a singleton context?
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
attr_reader :singleton
|
|
27
27
|
|
|
28
28
|
##
|
|
29
|
-
#
|
|
30
|
-
|
|
31
|
-
attr_reader :text
|
|
32
|
-
|
|
33
|
-
##
|
|
34
|
-
# Creates a new Alias with a token stream of +text+ that aliases +old_name+
|
|
29
|
+
# Creates a new Alias that aliases +old_name+
|
|
35
30
|
# to +new_name+, has +comment+ and is a +singleton+ context.
|
|
36
31
|
|
|
37
|
-
def initialize(
|
|
32
|
+
def initialize(old_name, new_name, comment, singleton: false)
|
|
38
33
|
super()
|
|
39
34
|
|
|
40
|
-
@text = text
|
|
41
35
|
@singleton = singleton
|
|
42
36
|
@old_name = old_name
|
|
43
37
|
@new_name = new_name
|
|
@@ -59,18 +53,11 @@ class RDoc::Alias < RDoc::CodeObject
|
|
|
59
53
|
"#alias-#{type}-#{html_name}"
|
|
60
54
|
end
|
|
61
55
|
|
|
62
|
-
##
|
|
63
|
-
# Full old name including namespace
|
|
64
|
-
|
|
65
|
-
def full_old_name
|
|
66
|
-
@full_name || "#{parent.name}#{pretty_old_name}"
|
|
67
|
-
end
|
|
68
|
-
|
|
69
56
|
##
|
|
70
57
|
# HTML id-friendly version of +#new_name+.
|
|
71
58
|
|
|
72
59
|
def html_name
|
|
73
|
-
CGI.escape(@new_name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '')
|
|
60
|
+
CGI.escape(@new_name.gsub('-', '-2D')).gsub('%', '-').sub(/^-/, '')
|
|
74
61
|
end
|
|
75
62
|
|
|
76
63
|
def inspect # :nodoc:
|
|
@@ -109,4 +96,3 @@ class RDoc::Alias < RDoc::CodeObject
|
|
|
109
96
|
end
|
|
110
97
|
|
|
111
98
|
end
|
|
112
|
-
|
|
@@ -13,8 +13,10 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
|
13
13
|
# 3::
|
|
14
14
|
# RDoc 4.1
|
|
15
15
|
# Added is_alias_for
|
|
16
|
+
# 4::
|
|
17
|
+
# Added type_signature_lines (serialized as joined string)
|
|
16
18
|
|
|
17
|
-
MARSHAL_VERSION =
|
|
19
|
+
MARSHAL_VERSION = 4 # :nodoc:
|
|
18
20
|
|
|
19
21
|
##
|
|
20
22
|
# Don't rename \#initialize to \::new
|
|
@@ -26,9 +28,8 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
|
26
28
|
|
|
27
29
|
attr_accessor :c_function
|
|
28
30
|
|
|
29
|
-
#
|
|
30
|
-
|
|
31
|
-
attr_accessor :params
|
|
31
|
+
# The section title of the method (if defined in a C file via +:category:+)
|
|
32
|
+
attr_accessor :section_title
|
|
32
33
|
|
|
33
34
|
##
|
|
34
35
|
# If true this method uses +super+ to call a superclass version
|
|
@@ -38,10 +39,10 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
|
38
39
|
include RDoc::TokenStream
|
|
39
40
|
|
|
40
41
|
##
|
|
41
|
-
# Creates a new AnyMethod with
|
|
42
|
+
# Creates a new AnyMethod with name +name+
|
|
42
43
|
|
|
43
|
-
def initialize
|
|
44
|
-
super
|
|
44
|
+
def initialize(name, singleton: false)
|
|
45
|
+
super(name, singleton: singleton)
|
|
45
46
|
|
|
46
47
|
@c_function = nil
|
|
47
48
|
@dont_rename_initialize = false
|
|
@@ -53,15 +54,15 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
|
53
54
|
##
|
|
54
55
|
# Adds +an_alias+ as an alias for this method in +context+.
|
|
55
56
|
|
|
56
|
-
def add_alias
|
|
57
|
-
method = self.class.new an_alias.
|
|
57
|
+
def add_alias(an_alias, context = nil)
|
|
58
|
+
method = self.class.new an_alias.new_name, singleton: singleton
|
|
58
59
|
|
|
59
60
|
method.record_location an_alias.file
|
|
60
|
-
method.singleton = self.singleton
|
|
61
61
|
method.params = self.params
|
|
62
62
|
method.visibility = self.visibility
|
|
63
63
|
method.comment = an_alias.comment
|
|
64
64
|
method.is_alias_for = self
|
|
65
|
+
method.type_signature_lines = self.type_signature_lines
|
|
65
66
|
@aliases << method
|
|
66
67
|
context.add_method method if context
|
|
67
68
|
method
|
|
@@ -106,12 +107,19 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
|
106
107
|
#
|
|
107
108
|
# See also #param_seq
|
|
108
109
|
|
|
109
|
-
def call_seq=
|
|
110
|
-
return if call_seq.empty?
|
|
110
|
+
def call_seq=(call_seq)
|
|
111
|
+
return if call_seq.nil? || call_seq.empty?
|
|
111
112
|
|
|
112
113
|
@call_seq = call_seq
|
|
113
114
|
end
|
|
114
115
|
|
|
116
|
+
##
|
|
117
|
+
# Whether the method has a call-seq.
|
|
118
|
+
|
|
119
|
+
def has_call_seq?
|
|
120
|
+
!!(@call_seq || is_alias_for&._call_seq)
|
|
121
|
+
end
|
|
122
|
+
|
|
115
123
|
##
|
|
116
124
|
# Loads is_alias_for from the internal name. Returns nil if the alias
|
|
117
125
|
# cannot be found.
|
|
@@ -161,6 +169,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
|
161
169
|
@parent.class,
|
|
162
170
|
@section.title,
|
|
163
171
|
is_alias_for,
|
|
172
|
+
@type_signature_lines&.join("\n"),
|
|
164
173
|
]
|
|
165
174
|
end
|
|
166
175
|
|
|
@@ -171,7 +180,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
|
171
180
|
# * #full_name
|
|
172
181
|
# * #parent_name
|
|
173
182
|
|
|
174
|
-
def marshal_load
|
|
183
|
+
def marshal_load(array)
|
|
175
184
|
initialize_visibility
|
|
176
185
|
|
|
177
186
|
@dont_rename_initialize = nil
|
|
@@ -188,7 +197,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
|
188
197
|
@full_name = array[2]
|
|
189
198
|
@singleton = array[3]
|
|
190
199
|
@visibility = array[4]
|
|
191
|
-
@comment = array[5]
|
|
200
|
+
@comment = RDoc::Comment.from_document array[5]
|
|
192
201
|
@call_seq = array[6]
|
|
193
202
|
@block_params = array[7]
|
|
194
203
|
# 8 handled below
|
|
@@ -199,9 +208,10 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
|
199
208
|
@parent_title = array[13]
|
|
200
209
|
@section_title = array[14]
|
|
201
210
|
@is_alias_for = array[15]
|
|
211
|
+
@type_signature_lines = array[16]&.split("\n")
|
|
202
212
|
|
|
203
|
-
array[8].each do |new_name,
|
|
204
|
-
add_alias RDoc::Alias.new(
|
|
213
|
+
array[8].each do |new_name, document|
|
|
214
|
+
add_alias RDoc::Alias.new(@name, new_name, RDoc::Comment.from_document(document), singleton: @singleton)
|
|
205
215
|
end
|
|
206
216
|
|
|
207
217
|
@parent_name ||= if @full_name =~ /#/ then
|
|
@@ -293,10 +303,18 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
|
293
303
|
params
|
|
294
304
|
end
|
|
295
305
|
|
|
306
|
+
##
|
|
307
|
+
# Whether to skip the method description, true for methods that have
|
|
308
|
+
# aliases with a call-seq that doesn't include the method name.
|
|
309
|
+
|
|
310
|
+
def skip_description?
|
|
311
|
+
has_call_seq? && call_seq.nil? && !!(is_alias_for || !aliases.empty?)
|
|
312
|
+
end
|
|
313
|
+
|
|
296
314
|
##
|
|
297
315
|
# Sets the store for this method and its referenced code objects.
|
|
298
316
|
|
|
299
|
-
def store=
|
|
317
|
+
def store=(store)
|
|
300
318
|
super
|
|
301
319
|
|
|
302
320
|
@file = @store.add_file @file.full_name if @file
|
|
@@ -338,7 +356,6 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
|
338
356
|
return call_seq unless is_alias_for || !aliases.empty?
|
|
339
357
|
|
|
340
358
|
method_name = self.name
|
|
341
|
-
method_name = method_name[0, 1] if method_name =~ /\A\[/
|
|
342
359
|
|
|
343
360
|
entries = call_seq.split "\n"
|
|
344
361
|
|
|
@@ -347,15 +364,24 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
|
347
364
|
ignore << is_alias_for.name
|
|
348
365
|
ignore.concat is_alias_for.aliases.map(&:name)
|
|
349
366
|
end
|
|
350
|
-
|
|
367
|
+
|
|
351
368
|
ignore.delete(method_name)
|
|
352
|
-
|
|
369
|
+
ignore_bracket_methods, ignore_other_methods = ignore.partition {|i| i.start_with?('[') }
|
|
353
370
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
371
|
+
if ignore_other_methods.any?
|
|
372
|
+
ignore_union = Regexp.union(ignore_other_methods)
|
|
373
|
+
entries.reject! do |entry|
|
|
374
|
+
/\A(?:\w*\.)?#{ignore_union}(?:[(\s]|\z)/.match?(entry) ||
|
|
375
|
+
/\s#{ignore_union}\s/.match?(entry)
|
|
376
|
+
end
|
|
377
|
+
end
|
|
378
|
+
if ignore_bracket_methods.any?
|
|
379
|
+
entries.reject! do |entry|
|
|
380
|
+
# Ignore `receiver[arg] -> return_type` `[](arg)` `[]`
|
|
381
|
+
/\A\w*\[.*?\](?:[(\s]|\z)/.match?(entry)
|
|
382
|
+
end
|
|
357
383
|
end
|
|
358
384
|
|
|
359
|
-
|
|
385
|
+
entries.empty? ? nil : entries.join("\n")
|
|
360
386
|
end
|
|
361
387
|
end
|
|
@@ -10,8 +10,10 @@ class RDoc::Attr < RDoc::MethodAttr
|
|
|
10
10
|
# RDoc 4
|
|
11
11
|
# Added parent name and class
|
|
12
12
|
# Added section title
|
|
13
|
+
# 4::
|
|
14
|
+
# Added type_signature_lines (serialized as joined string)
|
|
13
15
|
|
|
14
|
-
MARSHAL_VERSION =
|
|
16
|
+
MARSHAL_VERSION = 4 # :nodoc:
|
|
15
17
|
|
|
16
18
|
##
|
|
17
19
|
# Is the attribute readable ('R'), writable ('W') or both ('RW')?
|
|
@@ -19,21 +21,20 @@ class RDoc::Attr < RDoc::MethodAttr
|
|
|
19
21
|
attr_accessor :rw
|
|
20
22
|
|
|
21
23
|
##
|
|
22
|
-
# Creates a new Attr with
|
|
24
|
+
# Creates a new Attr with +name+, read/write status +rw+ and
|
|
23
25
|
# +comment+. +singleton+ marks this as a class attribute.
|
|
24
26
|
|
|
25
|
-
def initialize(
|
|
26
|
-
super
|
|
27
|
+
def initialize(name, rw, comment, singleton: false)
|
|
28
|
+
super(name, singleton: singleton)
|
|
27
29
|
|
|
28
30
|
@rw = rw
|
|
29
|
-
@singleton = singleton
|
|
30
31
|
self.comment = comment
|
|
31
32
|
end
|
|
32
33
|
|
|
33
34
|
##
|
|
34
35
|
# Attributes are equal when their names, singleton and rw are identical
|
|
35
36
|
|
|
36
|
-
def ==
|
|
37
|
+
def ==(other)
|
|
37
38
|
self.class == other.class and
|
|
38
39
|
self.name == other.name and
|
|
39
40
|
self.rw == other.rw and
|
|
@@ -44,12 +45,12 @@ class RDoc::Attr < RDoc::MethodAttr
|
|
|
44
45
|
# Add +an_alias+ as an attribute in +context+.
|
|
45
46
|
|
|
46
47
|
def add_alias(an_alias, context)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
access_type = an_alias.new_name.end_with?('=') ? 'W' : 'R'
|
|
49
|
+
new_attr = self.class.new(an_alias.new_name, access_type, comment, singleton: singleton)
|
|
50
50
|
new_attr.record_location an_alias.file
|
|
51
51
|
new_attr.visibility = self.visibility
|
|
52
52
|
new_attr.is_alias_for = self
|
|
53
|
+
new_attr.type_signature_lines = self.type_signature_lines
|
|
53
54
|
@aliases << new_attr
|
|
54
55
|
context.add_attribute new_attr
|
|
55
56
|
new_attr
|
|
@@ -110,7 +111,8 @@ class RDoc::Attr < RDoc::MethodAttr
|
|
|
110
111
|
@file.relative_name,
|
|
111
112
|
@parent.full_name,
|
|
112
113
|
@parent.class,
|
|
113
|
-
@section.title
|
|
114
|
+
@section.title,
|
|
115
|
+
@type_signature_lines&.join("\n"),
|
|
114
116
|
]
|
|
115
117
|
end
|
|
116
118
|
|
|
@@ -121,7 +123,7 @@ class RDoc::Attr < RDoc::MethodAttr
|
|
|
121
123
|
# * #full_name
|
|
122
124
|
# * #parent_name
|
|
123
125
|
|
|
124
|
-
def marshal_load
|
|
126
|
+
def marshal_load(array)
|
|
125
127
|
initialize_visibility
|
|
126
128
|
|
|
127
129
|
@aliases = []
|
|
@@ -136,19 +138,20 @@ class RDoc::Attr < RDoc::MethodAttr
|
|
|
136
138
|
@full_name = array[2]
|
|
137
139
|
@rw = array[3]
|
|
138
140
|
@visibility = array[4]
|
|
139
|
-
@comment = array[5]
|
|
141
|
+
@comment = RDoc::Comment.from_document array[5]
|
|
140
142
|
@singleton = array[6] || false # MARSHAL_VERSION == 0
|
|
141
143
|
# 7 handled below
|
|
142
144
|
@parent_name = array[8]
|
|
143
145
|
@parent_class = array[9]
|
|
144
146
|
@section_title = array[10]
|
|
147
|
+
@type_signature_lines = array[11]&.split("\n")
|
|
145
148
|
|
|
146
149
|
@file = RDoc::TopLevel.new array[7] if version > 1
|
|
147
150
|
|
|
148
151
|
@parent_name ||= @full_name.split('#', 2).first
|
|
149
152
|
end
|
|
150
153
|
|
|
151
|
-
def pretty_print
|
|
154
|
+
def pretty_print(q) # :nodoc:
|
|
152
155
|
q.group 2, "[#{self.class.name} #{full_name} #{rw} #{visibility}", "]" do
|
|
153
156
|
unless comment.empty? then
|
|
154
157
|
q.breakable
|
|
@@ -173,4 +176,3 @@ class RDoc::Attr < RDoc::MethodAttr
|
|
|
173
176
|
end
|
|
174
177
|
|
|
175
178
|
end
|
|
176
|
-
|