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.
Files changed (205) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +195 -0
  3. data/History.rdoc +65 -63
  4. data/LEGAL.rdoc +7 -1
  5. data/LICENSE.rdoc +6 -0
  6. data/README.md +236 -0
  7. data/RI.md +842 -0
  8. data/TODO.rdoc +8 -7
  9. data/doc/markup_reference/markdown.md +659 -0
  10. data/doc/markup_reference/rdoc.rdoc +1169 -0
  11. data/exe/rdoc +0 -1
  12. data/lib/rdoc/{alias.rb → code_object/alias.rb} +4 -18
  13. data/lib/rdoc/{any_method.rb → code_object/any_method.rb} +50 -24
  14. data/lib/rdoc/{attr.rb → code_object/attr.rb} +16 -14
  15. data/lib/rdoc/{class_module.rb → code_object/class_module.rb} +225 -58
  16. data/lib/rdoc/{constant.rb → code_object/constant.rb} +44 -10
  17. data/lib/rdoc/code_object/context/section.rb +182 -0
  18. data/lib/rdoc/{context.rb → code_object/context.rb} +78 -106
  19. data/lib/rdoc/{extend.rb → code_object/extend.rb} +0 -1
  20. data/lib/rdoc/{include.rb → code_object/include.rb} +0 -1
  21. data/lib/rdoc/{method_attr.rb → code_object/method_attr.rb} +46 -48
  22. data/lib/rdoc/{mixin.rb → code_object/mixin.rb} +6 -4
  23. data/lib/rdoc/{normal_class.rb → code_object/normal_class.rb} +2 -3
  24. data/lib/rdoc/{normal_module.rb → code_object/normal_module.rb} +2 -3
  25. data/lib/rdoc/{require.rb → code_object/require.rb} +1 -2
  26. data/lib/rdoc/{single_class.rb → code_object/single_class.rb} +5 -1
  27. data/lib/rdoc/{top_level.rb → code_object/top_level.rb} +60 -63
  28. data/lib/rdoc/code_object.rb +11 -39
  29. data/lib/rdoc/code_objects.rb +1 -2
  30. data/lib/rdoc/comment.rb +202 -99
  31. data/lib/rdoc/cross_reference.rb +75 -62
  32. data/lib/rdoc/encoding.rb +8 -24
  33. data/lib/rdoc/erb_partial.rb +1 -2
  34. data/lib/rdoc/erbio.rb +3 -8
  35. data/lib/rdoc/generator/aliki.rb +200 -0
  36. data/lib/rdoc/generator/darkfish.rb +156 -122
  37. data/lib/rdoc/generator/json_index.rb +8 -24
  38. data/lib/rdoc/generator/markup.rb +70 -34
  39. data/lib/rdoc/generator/pot/message_extractor.rb +7 -7
  40. data/lib/rdoc/generator/pot/po.rb +1 -1
  41. data/lib/rdoc/generator/pot/po_entry.rb +8 -8
  42. data/lib/rdoc/generator/pot.rb +1 -5
  43. data/lib/rdoc/generator/ri.rb +1 -2
  44. data/lib/rdoc/generator/template/aliki/DESIGN.md +536 -0
  45. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
  46. data/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
  47. data/lib/rdoc/generator/template/aliki/_head.rhtml +163 -0
  48. data/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
  49. data/lib/rdoc/generator/template/aliki/_icons.rhtml +208 -0
  50. data/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
  51. data/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
  52. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +27 -0
  53. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +27 -0
  54. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
  55. data/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
  56. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
  57. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
  58. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
  59. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
  60. data/lib/rdoc/generator/template/aliki/class.rhtml +230 -0
  61. data/lib/rdoc/generator/template/aliki/css/rdoc.css +2181 -0
  62. data/lib/rdoc/generator/template/aliki/index.rhtml +22 -0
  63. data/lib/rdoc/generator/template/aliki/js/aliki.js +513 -0
  64. data/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
  65. data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
  66. data/lib/rdoc/generator/template/aliki/js/search_controller.js +129 -0
  67. data/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
  68. data/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
  69. data/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
  70. data/lib/rdoc/generator/template/aliki/page.rhtml +18 -0
  71. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
  72. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
  73. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +3 -3
  74. data/lib/rdoc/generator/template/darkfish/_head.rhtml +35 -14
  75. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -5
  76. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +11 -9
  77. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +11 -9
  78. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +7 -6
  79. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +20 -11
  80. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +25 -5
  81. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +4 -9
  82. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +2 -1
  83. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +4 -4
  84. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +28 -7
  85. data/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
  86. data/lib/rdoc/generator/template/darkfish/class.rhtml +138 -90
  87. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +420 -358
  88. data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
  89. data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
  90. data/lib/rdoc/generator/template/darkfish/index.rhtml +14 -12
  91. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +59 -3
  92. data/lib/rdoc/generator/template/darkfish/js/search.js +15 -5
  93. data/lib/rdoc/generator/template/darkfish/page.rhtml +7 -6
  94. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +12 -9
  95. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +24 -21
  96. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +35 -21
  97. data/lib/rdoc/generator/template/json_index/js/navigation.js +8 -8
  98. data/lib/rdoc/generator/template/json_index/js/searcher.js +48 -6
  99. data/lib/rdoc/generator.rb +6 -5
  100. data/lib/rdoc/i18n/text.rb +3 -3
  101. data/lib/rdoc/i18n.rb +1 -1
  102. data/lib/rdoc/known_classes.rb +5 -4
  103. data/lib/rdoc/markdown/entities.rb +0 -1
  104. data/lib/rdoc/markdown/literals.kpeg +0 -2
  105. data/lib/rdoc/markdown/literals.rb +0 -1
  106. data/lib/rdoc/markdown.kpeg +140 -62
  107. data/lib/rdoc/markdown.rb +1015 -873
  108. data/lib/rdoc/markup/blank_line.rb +25 -24
  109. data/lib/rdoc/markup/block_quote.rb +1 -2
  110. data/lib/rdoc/markup/document.rb +10 -11
  111. data/lib/rdoc/markup/element.rb +21 -0
  112. data/lib/rdoc/markup/formatter.rb +134 -115
  113. data/lib/rdoc/markup/hard_break.rb +30 -28
  114. data/lib/rdoc/markup/heading.rb +163 -72
  115. data/lib/rdoc/markup/include.rb +3 -4
  116. data/lib/rdoc/markup/indented_paragraph.rb +4 -5
  117. data/lib/rdoc/markup/inline_parser.rb +312 -0
  118. data/lib/rdoc/markup/list.rb +6 -7
  119. data/lib/rdoc/markup/list_item.rb +6 -7
  120. data/lib/rdoc/markup/paragraph.rb +2 -3
  121. data/lib/rdoc/markup/parser.rb +29 -19
  122. data/lib/rdoc/markup/pre_process.rb +39 -18
  123. data/lib/rdoc/markup/raw.rb +52 -56
  124. data/lib/rdoc/markup/rule.rb +2 -3
  125. data/lib/rdoc/markup/table.rb +49 -32
  126. data/lib/rdoc/markup/to_ansi.rb +58 -8
  127. data/lib/rdoc/markup/to_bs.rb +47 -38
  128. data/lib/rdoc/markup/to_html.rb +343 -105
  129. data/lib/rdoc/markup/to_html_crossref.rb +143 -58
  130. data/lib/rdoc/markup/to_html_snippet.rb +78 -76
  131. data/lib/rdoc/markup/to_joined_paragraph.rb +3 -9
  132. data/lib/rdoc/markup/to_label.rb +34 -25
  133. data/lib/rdoc/markup/to_markdown.rb +74 -51
  134. data/lib/rdoc/markup/to_rdoc.rb +141 -82
  135. data/lib/rdoc/markup/to_table_of_contents.rb +4 -5
  136. data/lib/rdoc/markup/to_test.rb +10 -3
  137. data/lib/rdoc/markup/to_tt_only.rb +17 -31
  138. data/lib/rdoc/markup/verbatim.rb +5 -6
  139. data/lib/rdoc/markup.rb +59 -707
  140. data/lib/rdoc/options.rb +228 -101
  141. data/lib/rdoc/parser/c.rb +186 -184
  142. data/lib/rdoc/parser/changelog.rb +57 -13
  143. data/lib/rdoc/parser/markdown.rb +0 -2
  144. data/lib/rdoc/parser/rbs.rb +275 -0
  145. data/lib/rdoc/parser/rd.rb +0 -1
  146. data/lib/rdoc/parser/ruby.rb +963 -2024
  147. data/lib/rdoc/parser/ruby_colorizer.rb +253 -0
  148. data/lib/rdoc/parser/simple.rb +6 -23
  149. data/lib/rdoc/parser/text.rb +0 -1
  150. data/lib/rdoc/parser.rb +35 -14
  151. data/lib/rdoc/rbs_helper.rb +186 -0
  152. data/lib/rdoc/rd/block_parser.rb +659 -11
  153. data/lib/rdoc/rd/block_parser.ry +13 -9
  154. data/lib/rdoc/rd/inline.rb +4 -5
  155. data/lib/rdoc/rd/inline_parser.rb +646 -2
  156. data/lib/rdoc/rd.rb +4 -5
  157. data/lib/rdoc/rdoc.rb +234 -90
  158. data/lib/rdoc/ri/driver.rb +172 -172
  159. data/lib/rdoc/ri/paths.rb +3 -3
  160. data/lib/rdoc/{servlet.rb → ri/servlet.rb} +28 -27
  161. data/lib/rdoc/ri/store.rb +0 -1
  162. data/lib/rdoc/ri/task.rb +3 -3
  163. data/lib/rdoc/ri.rb +5 -5
  164. data/lib/rdoc/rubygems_hook.rb +106 -25
  165. data/lib/rdoc/server.rb +460 -0
  166. data/lib/rdoc/stats/normal.rb +1 -1
  167. data/lib/rdoc/stats/quiet.rb +1 -2
  168. data/lib/rdoc/stats/verbose.rb +3 -5
  169. data/lib/rdoc/stats.rb +158 -136
  170. data/lib/rdoc/store.rb +267 -48
  171. data/lib/rdoc/task.rb +54 -28
  172. data/lib/rdoc/text.rb +60 -120
  173. data/lib/rdoc/token_stream.rb +30 -45
  174. data/lib/rdoc/tom_doc.rb +9 -15
  175. data/lib/rdoc/version.rb +3 -1
  176. data/lib/rdoc.rb +90 -52
  177. data/lib/rubygems_plugin.rb +14 -0
  178. data/man/ri.1 +2 -0
  179. data/rdoc-logo.svg +43 -0
  180. data/rdoc.gemspec +25 -200
  181. metadata +120 -53
  182. data/CONTRIBUTING.rdoc +0 -220
  183. data/ExampleMarkdown.md +0 -37
  184. data/ExampleRDoc.rdoc +0 -208
  185. data/Gemfile +0 -12
  186. data/README.rdoc +0 -129
  187. data/RI.rdoc +0 -57
  188. data/Rakefile +0 -101
  189. data/bin/console +0 -7
  190. data/bin/setup +0 -6
  191. data/lib/rdoc/anon_class.rb +0 -11
  192. data/lib/rdoc/context/section.rb +0 -232
  193. data/lib/rdoc/generator/template/darkfish/.document +0 -0
  194. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
  195. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
  196. data/lib/rdoc/generator/template/json_index/.document +0 -1
  197. data/lib/rdoc/ghost_method.rb +0 -7
  198. data/lib/rdoc/markup/attr_changer.rb +0 -23
  199. data/lib/rdoc/markup/attr_span.rb +0 -36
  200. data/lib/rdoc/markup/attribute_manager.rb +0 -409
  201. data/lib/rdoc/markup/attributes.rb +0 -71
  202. data/lib/rdoc/markup/regexp_handling.rb +0 -41
  203. data/lib/rdoc/meta_method.rb +0 -7
  204. data/lib/rdoc/parser/ripper_state_lex.rb +0 -590
  205. data/lib/rdoc/parser/ruby_tools.rb +0 -167
data/exe/rdoc CHANGED
@@ -41,4 +41,3 @@ rescue Exception => e
41
41
 
42
42
  exit 1
43
43
  end
44
-
@@ -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
- attr_accessor :singleton
26
+ attr_reader :singleton
27
27
 
28
28
  ##
29
- # Source file token stream
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(text, old_name, new_name, comment, singleton = false)
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 = 3 # :nodoc:
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
- # Parameters for this method
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 a token stream +text+ and +name+
42
+ # Creates a new AnyMethod with name +name+
42
43
 
43
- def initialize text, name
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 an_alias, context = nil
57
- method = self.class.new an_alias.text, an_alias.new_name
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= 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 array
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, comment|
204
- add_alias RDoc::Alias.new(nil, @name, new_name, comment, @singleton)
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= 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
- ignore.map! { |n| n =~ /\A\[/ ? n[0, 1] : n}
367
+
351
368
  ignore.delete(method_name)
352
- ignore = Regexp.union(ignore)
369
+ ignore_bracket_methods, ignore_other_methods = ignore.partition {|i| i.start_with?('[') }
353
370
 
354
- matching = entries.reject do |entry|
355
- entry =~ /^\w*\.?#{ignore}/ or
356
- entry =~ /\s#{ignore}\s/
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
- matching.join "\n"
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 = 3 # :nodoc:
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 body +text+, +name+, read/write status +rw+ and
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(text, name, rw, comment, singleton = false)
26
- super text, name
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 == other
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
- new_attr = self.class.new(self.text, an_alias.new_name, self.rw,
48
- self.comment, self.singleton)
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 array
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 q # :nodoc:
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
-