rdoc 6.13.0 → 6.17.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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/History.rdoc +1 -1
  3. data/README.md +112 -0
  4. data/RI.md +1 -1
  5. data/lib/rdoc/code_object/any_method.rb +4 -4
  6. data/lib/rdoc/code_object/attr.rb +3 -3
  7. data/lib/rdoc/code_object/class_module.rb +18 -16
  8. data/lib/rdoc/code_object/constant.rb +5 -5
  9. data/lib/rdoc/code_object/context/section.rb +8 -7
  10. data/lib/rdoc/code_object/context.rb +19 -19
  11. data/lib/rdoc/code_object/method_attr.rb +7 -6
  12. data/lib/rdoc/code_object/mixin.rb +3 -3
  13. data/lib/rdoc/code_object/normal_class.rb +1 -1
  14. data/lib/rdoc/code_object/normal_module.rb +1 -1
  15. data/lib/rdoc/code_object/single_class.rb +1 -1
  16. data/lib/rdoc/code_object/top_level.rb +28 -33
  17. data/lib/rdoc/code_object.rb +3 -3
  18. data/lib/rdoc/comment.rb +196 -14
  19. data/lib/rdoc/cross_reference.rb +4 -4
  20. data/lib/rdoc/encoding.rb +4 -4
  21. data/lib/rdoc/erb_partial.rb +1 -1
  22. data/lib/rdoc/erbio.rb +2 -2
  23. data/lib/rdoc/generator/aliki.rb +42 -0
  24. data/lib/rdoc/generator/darkfish.rb +20 -16
  25. data/lib/rdoc/generator/json_index.rb +3 -3
  26. data/lib/rdoc/generator/markup.rb +12 -0
  27. data/lib/rdoc/generator/pot/message_extractor.rb +4 -4
  28. data/lib/rdoc/generator/pot/po.rb +1 -1
  29. data/lib/rdoc/generator/pot/po_entry.rb +7 -7
  30. data/lib/rdoc/generator/pot.rb +1 -1
  31. data/lib/rdoc/generator/ri.rb +1 -1
  32. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
  33. data/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
  34. data/lib/rdoc/generator/template/aliki/_head.rhtml +158 -0
  35. data/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
  36. data/lib/rdoc/generator/template/aliki/_icons.rhtml +208 -0
  37. data/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
  38. data/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
  39. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +25 -0
  40. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +25 -0
  41. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
  42. data/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
  43. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
  44. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
  45. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
  46. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
  47. data/lib/rdoc/generator/template/aliki/class.rhtml +220 -0
  48. data/lib/rdoc/generator/template/aliki/css/rdoc.css +1737 -0
  49. data/lib/rdoc/generator/template/aliki/index.rhtml +22 -0
  50. data/lib/rdoc/generator/template/aliki/js/aliki.js +483 -0
  51. data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
  52. data/lib/rdoc/generator/template/aliki/js/search.js +120 -0
  53. data/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
  54. data/lib/rdoc/generator/template/aliki/page.rhtml +18 -0
  55. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
  56. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
  57. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +3 -3
  58. data/lib/rdoc/generator/template/darkfish/_head.rhtml +16 -16
  59. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -8
  60. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -8
  61. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +7 -6
  62. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +6 -6
  63. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +19 -19
  64. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +2 -2
  65. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +1 -0
  66. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +3 -3
  67. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +14 -14
  68. data/lib/rdoc/generator/template/darkfish/class.rhtml +62 -60
  69. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +2 -0
  70. data/lib/rdoc/generator/template/darkfish/index.rhtml +4 -3
  71. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +21 -1
  72. data/lib/rdoc/generator/template/darkfish/js/search.js +11 -1
  73. data/lib/rdoc/generator/template/darkfish/page.rhtml +2 -1
  74. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +2 -1
  75. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +19 -19
  76. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +19 -17
  77. data/lib/rdoc/generator/template/json_index/js/searcher.js +48 -6
  78. data/lib/rdoc/generator.rb +1 -0
  79. data/lib/rdoc/markdown.kpeg +72 -18
  80. data/lib/rdoc/markdown.rb +411 -547
  81. data/lib/rdoc/markup/attribute_manager.rb +5 -5
  82. data/lib/rdoc/markup/attributes.rb +3 -3
  83. data/lib/rdoc/markup/blank_line.rb +2 -2
  84. data/lib/rdoc/markup/block_quote.rb +1 -1
  85. data/lib/rdoc/markup/document.rb +8 -8
  86. data/lib/rdoc/markup/formatter.rb +12 -12
  87. data/lib/rdoc/markup/hard_break.rb +3 -3
  88. data/lib/rdoc/markup/heading.rb +4 -4
  89. data/lib/rdoc/markup/include.rb +3 -3
  90. data/lib/rdoc/markup/indented_paragraph.rb +3 -3
  91. data/lib/rdoc/markup/list.rb +4 -4
  92. data/lib/rdoc/markup/list_item.rb +4 -4
  93. data/lib/rdoc/markup/paragraph.rb +2 -2
  94. data/lib/rdoc/markup/parser.rb +11 -11
  95. data/lib/rdoc/markup/pre_process.rb +39 -15
  96. data/lib/rdoc/markup/raw.rb +5 -5
  97. data/lib/rdoc/markup/rule.rb +2 -2
  98. data/lib/rdoc/markup/table.rb +4 -4
  99. data/lib/rdoc/markup/to_ansi.rb +7 -3
  100. data/lib/rdoc/markup/to_bs.rb +10 -6
  101. data/lib/rdoc/markup/to_html.rb +182 -30
  102. data/lib/rdoc/markup/to_html_crossref.rb +58 -28
  103. data/lib/rdoc/markup/to_html_snippet.rb +17 -17
  104. data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
  105. data/lib/rdoc/markup/to_label.rb +6 -5
  106. data/lib/rdoc/markup/to_markdown.rb +12 -12
  107. data/lib/rdoc/markup/to_rdoc.rb +40 -31
  108. data/lib/rdoc/markup/to_table_of_contents.rb +3 -3
  109. data/lib/rdoc/markup/to_test.rb +1 -1
  110. data/lib/rdoc/markup/to_tt_only.rb +8 -8
  111. data/lib/rdoc/markup/verbatim.rb +3 -3
  112. data/lib/rdoc/markup.rb +3 -3
  113. data/lib/rdoc/options.rb +53 -23
  114. data/lib/rdoc/parser/c.rb +31 -62
  115. data/lib/rdoc/parser/changelog.rb +9 -9
  116. data/lib/rdoc/parser/prism_ruby.rb +122 -114
  117. data/lib/rdoc/parser/ruby.rb +51 -51
  118. data/lib/rdoc/parser/ruby_tools.rb +5 -7
  119. data/lib/rdoc/parser/simple.rb +5 -22
  120. data/lib/rdoc/parser.rb +8 -8
  121. data/lib/rdoc/rd/inline.rb +4 -4
  122. data/lib/rdoc/rd.rb +1 -1
  123. data/lib/rdoc/rdoc.rb +9 -8
  124. data/lib/rdoc/ri/driver.rb +49 -49
  125. data/lib/rdoc/ri/paths.rb +2 -2
  126. data/lib/rdoc/ri/task.rb +3 -3
  127. data/lib/rdoc/rubygems_hook.rb +14 -11
  128. data/lib/rdoc/servlet.rb +15 -15
  129. data/lib/rdoc/stats/normal.rb +1 -1
  130. data/lib/rdoc/stats/quiet.rb +1 -1
  131. data/lib/rdoc/stats/verbose.rb +3 -3
  132. data/lib/rdoc/stats.rb +12 -12
  133. data/lib/rdoc/store.rb +32 -32
  134. data/lib/rdoc/task.rb +6 -6
  135. data/lib/rdoc/text.rb +11 -11
  136. data/lib/rdoc/token_stream.rb +14 -2
  137. data/lib/rdoc/tom_doc.rb +8 -8
  138. data/lib/rdoc/version.rb +1 -1
  139. data/man/ri.1 +2 -0
  140. data/rdoc.gemspec +72 -0
  141. metadata +61 -6
  142. data/README.rdoc +0 -142
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 752c58278dac55778d56ab11ca257f5902224f23e0f0a50aa69e5868dfc3fb34
4
- data.tar.gz: bf83b7a81ffb712d5b377308a4af2b35d59a5d0c394b9082fae938399410931f
3
+ metadata.gz: 2bb82d9eff1cf5ae3ee5276c97b12d57694d28c64a70ee9f318d4468c904999e
4
+ data.tar.gz: f7073f27e9b4a15e3b7792f777bb8b2bc991bde74409e15cdb5bd7be1900f2db
5
5
  SHA512:
6
- metadata.gz: 85231fbcadaf3c4890808169e0ee5ffb83083a58dc803f8c67048fbfef9ff718f0d595d09b56772d916b7233a819fcf23874fc8386e65b5e9902e3f3b451e27a
7
- data.tar.gz: 63a2be58e2972b5aea4c57fc7c617246403de2c8e4436954225753d3271026311d2cc40344ffe15232a7df139af623994b012e6514bca940c724cb0da5a441a9
6
+ metadata.gz: 76a11b7a7529c4b008488ba22f4aa0c8c5dd2cbfff19ec795f0fa5f16e0d7c7f4913d69c2cc11d18653f8d0a4bde559f2b2a893b9dba9d8aec34faaec557b935
7
+ data.tar.gz: 5af47e79dc6fde12b8aa9809a0eb845db18031a907140484ea95ef16399a592c879445b8f725ae4eabfbfe5d3250656926698fa2a35b3426605420ca9961579f
data/History.rdoc CHANGED
@@ -163,7 +163,7 @@
163
163
  * Moved old DEVELOPERS file to CONTRIBUTING to match github conventions.
164
164
  * TomDoc output now has a "Returns" heading. Issue #234 by Brian Henderson
165
165
  * Metaprogrammed methods can now use the :args: directive in addition to the
166
- :call-seq: directive. Issue #236 by Mike Moore.
166
+ \:call-seq: directive. Issue #236 by Mike Moore.
167
167
  * Sections can be linked to using "@" like labels. If a section and a label
168
168
  have the same name the section will be preferred. Issue #233 by Brian
169
169
  Henderson.
data/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # RDoc - Ruby Documentation System
2
+
3
+ - GitHub: [https://github.com/ruby/rdoc](https://github.com/ruby/rdoc)
4
+ - Issues: [https://github.com/ruby/rdoc/issues](https://github.com/ruby/rdoc/issues)
5
+
6
+ ## Description
7
+
8
+ RDoc produces HTML and command-line documentation for Ruby projects. RDoc includes the `rdoc` and `ri` tools for generating and displaying documentation from the command-line.
9
+
10
+ ## Generating Documentation
11
+
12
+ Once installed, you can create documentation using the `rdoc` command
13
+
14
+ ```shell
15
+ rdoc [options] [names...]
16
+ ```
17
+
18
+ For an up-to-date option summary, type
19
+
20
+ ```shell
21
+ rdoc --help
22
+ ```
23
+
24
+ A typical use might be to generate documentation for a package of Ruby source (such as RDoc itself).
25
+
26
+ ```shell
27
+ rdoc
28
+ ```
29
+
30
+ This command generates documentation for all the Ruby and C source files in and below the current directory. These will be stored in a documentation tree starting in the subdirectory `doc`.
31
+
32
+ You can make this slightly more useful for your readers by having the index page contain the documentation for the primary file. In our case, we could type
33
+
34
+ ```shell
35
+ rdoc --main README.md
36
+ ```
37
+
38
+ You'll find information on the various formatting tricks you can use in comment blocks in the documentation this generates.
39
+
40
+ RDoc uses file extensions to determine how to process each file. File names ending `.rb` and `.rbw` are assumed to be Ruby source. Files ending `.c` are parsed as C files. All other files are assumed to contain just Markup-style markup (with or without leading `#` comment markers). If directory names are passed to RDoc, they are scanned recursively for C and Ruby source files only.
41
+
42
+ To generate documentation using `rake` see [RDoc::Task](https://ruby.github.io/rdoc/RDoc/Task.html).
43
+
44
+ To generate documentation programmatically:
45
+
46
+ ```rb
47
+ require 'rdoc/rdoc'
48
+
49
+ options = RDoc::Options.new
50
+ options.files = ['a.rb', 'b.rb']
51
+ options.setup_generator 'darkfish'
52
+ # see RDoc::Options
53
+
54
+ rdoc = RDoc::RDoc.new
55
+ rdoc.document options
56
+ # see RDoc::RDoc
57
+ ```
58
+
59
+ You can specify the target files for document generation with `.document` file in the project root directory. `.document` file contains a list of file and directory names including comment lines starting with `#`. See [https://github.com/ruby/rdoc/blob/master/.document](https://github.com/ruby/rdoc/blob/master/.document) as an example.
60
+
61
+ ## Writing Documentation
62
+
63
+ To write documentation for RDoc place a comment above the class, module, method, constant, or attribute you want documented:
64
+
65
+ ```rb
66
+ ##
67
+ # This class represents an arbitrary shape by a series of points.
68
+ class Shape
69
+ ##
70
+ # Creates a new shape described by a +polyline+.
71
+ #
72
+ # If the +polyline+ does not end at the same point it started at the
73
+ # first pointed is copied and placed at the end of the line.
74
+ #
75
+ # An ArgumentError is raised if the line crosses itself, but shapes may
76
+ # be concave.
77
+ def initialize polyline
78
+ # ...
79
+ end
80
+ end
81
+ ```
82
+
83
+ The default comment markup format is the RDoc::Markup format. TomDoc, Markdown and RD format comments are also supported. You can set the default comment format for your entire project by creating a `.rdoc_options` file. See RDoc::Options@Saved+Options for instructions on creating one. You can also set the comment format for a single file through the `:markup:` directive, but this is only recommended if you wish to switch markup formats. See RDoc::Markup@Other+directives.
84
+
85
+ Comments can contain directives that tell RDoc information that it cannot otherwise discover through parsing. See RDoc::Markup@Directives to control what is or is not documented, to define method arguments or to break up methods in a class by topic. See RDoc::Parser::Ruby for directives used to teach RDoc about metaprogrammed methods.
86
+
87
+ See RDoc::Parser::C for documenting C extensions with RDoc.
88
+
89
+ To determine how well your project is documented run `rdoc -C lib` to get a documentation coverage report. `rdoc -C1 lib` includes parameter names in the documentation coverage report.
90
+
91
+ ## Theme Options
92
+
93
+ There are a few community-maintained themes for RDoc:
94
+
95
+ - [rorvswild-theme-rdoc](https://github.com/BaseSecrete/rorvswild-theme-rdoc)
96
+ - [hanna](https://github.com/jeremyevans/hanna) (a fork maintained by [Jeremy Evans](https://github.com/jeremyevans))
97
+
98
+ Please follow the theme's README for usage instructions.
99
+
100
+ ## Bugs
101
+
102
+ See CONTRIBUTING.rdoc for information on filing a bug report. It's OK to file a bug report for anything you're having a problem with. If you can't figure out how to make RDoc produce the output you like that is probably a documentation bug.
103
+
104
+ ## License
105
+
106
+ RDoc is Copyright (c) 2001-2003 Dave Thomas, The Pragmatic Programmers. Portions (c) 2007-2011 Eric Hodel. Portions copyright others, see individual files and LEGAL.rdoc for details.
107
+
108
+ RDoc is free software, and may be redistributed under the terms specified in LICENSE.rdoc.
109
+
110
+ ## Warranty
111
+
112
+ This software is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.
data/RI.md CHANGED
@@ -48,7 +48,7 @@ the [Ruby online documentation](https://docs.ruby-lang.org/en/master):
48
48
  - If you are working in a terminal window, typing `ri _whatever_` (or just `ri`)
49
49
  may be faster than navigating to a browser window and searching for documentation.
50
50
  - If you are working in an
51
- [irb \(interactive Ruby\)](https://docs.ruby-lang.org/en/master/IRB.html)
51
+ [irb \(interactive Ruby\)](https://ruby.github.io/irb/index.html)
52
52
  session, you _already_ have immediate access to `ri`:
53
53
  just type `'show_doc'`.
54
54
 
@@ -52,7 +52,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
52
52
  ##
53
53
  # Adds +an_alias+ as an alias for this method in +context+.
54
54
 
55
- def add_alias an_alias, context = nil
55
+ def add_alias(an_alias, context = nil)
56
56
  method = self.class.new an_alias.text, an_alias.new_name, singleton: singleton
57
57
 
58
58
  method.record_location an_alias.file
@@ -104,7 +104,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
104
104
  #
105
105
  # See also #param_seq
106
106
 
107
- def call_seq= call_seq
107
+ def call_seq=(call_seq)
108
108
  return if call_seq.nil? || call_seq.empty?
109
109
 
110
110
  @call_seq = call_seq
@@ -176,7 +176,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
176
176
  # * #full_name
177
177
  # * #parent_name
178
178
 
179
- def marshal_load array
179
+ def marshal_load(array)
180
180
  initialize_visibility
181
181
 
182
182
  @dont_rename_initialize = nil
@@ -309,7 +309,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
309
309
  ##
310
310
  # Sets the store for this method and its referenced code objects.
311
311
 
312
- def store= store
312
+ def store=(store)
313
313
  super
314
314
 
315
315
  @file = @store.add_file @file.full_name if @file
@@ -32,7 +32,7 @@ class RDoc::Attr < RDoc::MethodAttr
32
32
  ##
33
33
  # Attributes are equal when their names, singleton and rw are identical
34
34
 
35
- def == other
35
+ def ==(other)
36
36
  self.class == other.class and
37
37
  self.name == other.name and
38
38
  self.rw == other.rw and
@@ -118,7 +118,7 @@ class RDoc::Attr < RDoc::MethodAttr
118
118
  # * #full_name
119
119
  # * #parent_name
120
120
 
121
- def marshal_load array
121
+ def marshal_load(array)
122
122
  initialize_visibility
123
123
 
124
124
  @aliases = []
@@ -145,7 +145,7 @@ class RDoc::Attr < RDoc::MethodAttr
145
145
  @parent_name ||= @full_name.split('#', 2).first
146
146
  end
147
147
 
148
- def pretty_print q # :nodoc:
148
+ def pretty_print(q) # :nodoc:
149
149
  q.group 2, "[#{self.class.name} #{full_name} #{rw} #{visibility}", "]" do
150
150
  unless comment.empty? then
151
151
  q.breakable
@@ -45,7 +45,7 @@ class RDoc::ClassModule < RDoc::Context
45
45
  #--
46
46
  # TODO move to RDoc::NormalClass (I think)
47
47
 
48
- def self.from_module class_type, mod
48
+ def self.from_module(class_type, mod)
49
49
  klass = class_type.new mod.name
50
50
 
51
51
  mod.comment_location.each do |comment, location|
@@ -120,7 +120,7 @@ class RDoc::ClassModule < RDoc::Context
120
120
  # method is preferred over #comment= since it allows ri data to be updated
121
121
  # across multiple runs.
122
122
 
123
- def add_comment comment, location
123
+ def add_comment(comment, location)
124
124
  return unless document_self
125
125
 
126
126
  original = comment
@@ -141,7 +141,7 @@ class RDoc::ClassModule < RDoc::Context
141
141
  self.comment = original
142
142
  end
143
143
 
144
- def add_things my_things, other_things # :nodoc:
144
+ def add_things(my_things, other_things) # :nodoc:
145
145
  other_things.each do |group, things|
146
146
  my_things[group].each { |thing| yield false, thing } if
147
147
  my_things.include? group
@@ -198,7 +198,7 @@ class RDoc::ClassModule < RDoc::Context
198
198
  # Appends +comment+ to the current comment, but separated by a rule. Works
199
199
  # more like <tt>+=</tt>.
200
200
 
201
- def comment= comment # :nodoc:
201
+ def comment=(comment) # :nodoc:
202
202
  comment = case comment
203
203
  when RDoc::Comment then
204
204
  comment.normalize
@@ -216,7 +216,7 @@ class RDoc::ClassModule < RDoc::Context
216
216
  #
217
217
  # See RDoc::Store#complete
218
218
 
219
- def complete min_visibility
219
+ def complete(min_visibility)
220
220
  update_aliases
221
221
  remove_nodoc_children
222
222
  embed_mixins
@@ -259,7 +259,7 @@ class RDoc::ClassModule < RDoc::Context
259
259
  ##
260
260
  # Looks for a symbol in the #ancestors. See Context#find_local_symbol.
261
261
 
262
- def find_ancestor_local_symbol symbol
262
+ def find_ancestor_local_symbol(symbol)
263
263
  each_ancestor do |m|
264
264
  res = m.find_local_symbol(symbol)
265
265
  return res if res
@@ -271,7 +271,7 @@ class RDoc::ClassModule < RDoc::Context
271
271
  ##
272
272
  # Finds a class or module with +name+ in this namespace or its descendants
273
273
 
274
- def find_class_named name
274
+ def find_class_named(name)
275
275
  return self if full_name == name
276
276
  return self if @name == name
277
277
 
@@ -360,7 +360,7 @@ class RDoc::ClassModule < RDoc::Context
360
360
  ]
361
361
  end
362
362
 
363
- def marshal_load array # :nodoc:
363
+ def marshal_load(array) # :nodoc:
364
364
  initialize_visibility
365
365
  initialize_methods_etc
366
366
  @current_section = nil
@@ -450,7 +450,7 @@ class RDoc::ClassModule < RDoc::Context
450
450
  #
451
451
  # The data in +class_module+ is preferred over the receiver.
452
452
 
453
- def merge class_module
453
+ def merge(class_module)
454
454
  @parent = class_module.parent
455
455
  @parent_name = class_module.parent_name
456
456
 
@@ -535,7 +535,7 @@ class RDoc::ClassModule < RDoc::Context
535
535
  # end
536
536
  # end
537
537
 
538
- def merge_collections mine, other, other_files, &block # :nodoc:
538
+ def merge_collections(mine, other, other_files, &block) # :nodoc:
539
539
  my_things = mine. group_by { |thing| thing.file }
540
540
  other_things = other.group_by { |thing| thing.file }
541
541
 
@@ -547,7 +547,7 @@ class RDoc::ClassModule < RDoc::Context
547
547
  # Merges the comments in this ClassModule with the comments in the other
548
548
  # ClassModule +cm+.
549
549
 
550
- def merge_sections cm # :nodoc:
550
+ def merge_sections(cm) # :nodoc:
551
551
  my_sections = sections.group_by { |section| section.title }
552
552
  other_sections = cm.sections.group_by { |section| section.title }
553
553
 
@@ -595,7 +595,7 @@ class RDoc::ClassModule < RDoc::Context
595
595
  #
596
596
  # Used for modules and classes that are constant aliases.
597
597
 
598
- def name= new_name
598
+ def name=(new_name)
599
599
  @name = new_name
600
600
  end
601
601
 
@@ -603,7 +603,7 @@ class RDoc::ClassModule < RDoc::Context
603
603
  # Parses +comment_location+ into an RDoc::Markup::Document composed of
604
604
  # multiple RDoc::Markup::Documents with their file set.
605
605
 
606
- def parse comment_location
606
+ def parse(comment_location)
607
607
  case comment_location
608
608
  when String then
609
609
  super
@@ -630,7 +630,9 @@ class RDoc::ClassModule < RDoc::Context
630
630
  # Path to this class or module for use with HTML generator output.
631
631
 
632
632
  def path
633
- http_url
633
+ prefix = options.class_module_path_prefix
634
+ return http_url unless prefix
635
+ File.join(prefix, http_url)
634
636
  end
635
637
 
636
638
  ##
@@ -673,7 +675,7 @@ class RDoc::ClassModule < RDoc::Context
673
675
  end
674
676
  end
675
677
 
676
- def remove_things my_things, other_files # :nodoc:
678
+ def remove_things(my_things, other_files) # :nodoc:
677
679
  my_things.delete_if do |file, things|
678
680
  next false unless other_files.include? file
679
681
 
@@ -703,7 +705,7 @@ class RDoc::ClassModule < RDoc::Context
703
705
  ##
704
706
  # Sets the store for this class or module and its contained code objects.
705
707
 
706
- def store= store
708
+ def store=(store)
707
709
  super
708
710
 
709
711
  @attributes .each do |attr| attr.store = store end
@@ -44,7 +44,7 @@ class RDoc::Constant < RDoc::CodeObject
44
44
  ##
45
45
  # Constants are ordered by name
46
46
 
47
- def <=> other
47
+ def <=>(other)
48
48
  return unless self.class === other
49
49
 
50
50
  [parent_name, name] <=> [other.parent_name, other.name]
@@ -53,7 +53,7 @@ class RDoc::Constant < RDoc::CodeObject
53
53
  ##
54
54
  # Constants are equal when their #parent and #name is the same
55
55
 
56
- def == other
56
+ def ==(other)
57
57
  self.class == other.class and
58
58
  @parent == other.parent and
59
59
  @name == other.name
@@ -132,7 +132,7 @@ class RDoc::Constant < RDoc::CodeObject
132
132
  # * #full_name
133
133
  # * #parent_name
134
134
 
135
- def marshal_load array
135
+ def marshal_load(array)
136
136
  initialize array[1], nil, RDoc::Comment.from_document(array[5])
137
137
 
138
138
  @full_name = array[2]
@@ -154,7 +154,7 @@ class RDoc::Constant < RDoc::CodeObject
154
154
  "#{@parent.path}##{@name}"
155
155
  end
156
156
 
157
- def pretty_print q # :nodoc:
157
+ def pretty_print(q) # :nodoc:
158
158
  q.group 2, "[#{self.class.name} #{full_name}", "]" do
159
159
  unless comment.empty? then
160
160
  q.breakable
@@ -168,7 +168,7 @@ class RDoc::Constant < RDoc::CodeObject
168
168
  ##
169
169
  # Sets the store for this class or module and its contained code objects.
170
170
 
171
- def store= store
171
+ def store=(store)
172
172
  super
173
173
 
174
174
  @file = @store.add_file @file.full_name if @file
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
- require 'cgi/util'
2
+ require 'cgi/escape'
3
+ require 'cgi/util' unless defined?(CGI::EscapeExt)
3
4
 
4
5
  ##
5
6
  # A section of documentation like:
@@ -39,7 +40,7 @@ class RDoc::Context::Section
39
40
  ##
40
41
  # Creates a new section with +title+ and +comment+
41
42
 
42
- def initialize parent, title, comment
43
+ def initialize(parent, title, comment)
43
44
  @parent = parent
44
45
  @title = title ? title.strip : title
45
46
 
@@ -51,7 +52,7 @@ class RDoc::Context::Section
51
52
  ##
52
53
  # Sections are equal when they have the same #title
53
54
 
54
- def == other
55
+ def ==(other)
55
56
  self.class === other and @title == other.title
56
57
  end
57
58
 
@@ -60,7 +61,7 @@ class RDoc::Context::Section
60
61
  ##
61
62
  # Adds +comment+ to this section
62
63
 
63
- def add_comment comment
64
+ def add_comment(comment)
64
65
  comments = Array(comment)
65
66
  comments.each do |c|
66
67
  extracted_comment = extract_comment(c)
@@ -86,7 +87,7 @@ class RDoc::Context::Section
86
87
  # # :section: The title
87
88
  # # The body
88
89
 
89
- def extract_comment comment
90
+ def extract_comment(comment)
90
91
  case comment
91
92
  when nil
92
93
  RDoc::Comment.new ''
@@ -138,7 +139,7 @@ class RDoc::Context::Section
138
139
  ##
139
140
  # De-serializes this Section. The section parent must be restored manually.
140
141
 
141
- def marshal_load array
142
+ def marshal_load(array)
142
143
  @parent = nil
143
144
 
144
145
  @title = array[1]
@@ -166,7 +167,7 @@ class RDoc::Context::Section
166
167
  # Removes a comment from this section if it is from the same file as
167
168
  # +comment+
168
169
 
169
- def remove_comment target_comment
170
+ def remove_comment(target_comment)
170
171
  @comments.delete_if do |stored_comment|
171
172
  stored_comment.file == target_comment.file
172
173
  end
@@ -180,7 +180,7 @@ class RDoc::Context < RDoc::CodeObject
180
180
  #
181
181
  # Currently only RDoc::Extend and RDoc::Include are supported.
182
182
 
183
- def add klass, name, comment
183
+ def add(klass, name, comment)
184
184
  if RDoc::Extend == klass then
185
185
  ext = RDoc::Extend.new name, comment
186
186
  add_extend ext
@@ -195,7 +195,7 @@ class RDoc::Context < RDoc::CodeObject
195
195
  ##
196
196
  # Adds +an_alias+ that is automatically resolved
197
197
 
198
- def add_alias an_alias
198
+ def add_alias(an_alias)
199
199
  return an_alias unless @document_self
200
200
 
201
201
  method_attr = find_method(an_alias.old_name, an_alias.singleton) ||
@@ -222,7 +222,7 @@ class RDoc::Context < RDoc::CodeObject
222
222
  # if method +foo+ exists, but <tt>attr_accessor :foo</tt> will be registered
223
223
  # if method +foo+ exists, but <tt>foo=</tt> does not.
224
224
 
225
- def add_attribute attribute
225
+ def add_attribute(attribute)
226
226
  return attribute unless @document_self
227
227
 
228
228
  # mainly to check for redefinition of an attribute as a method
@@ -285,7 +285,7 @@ class RDoc::Context < RDoc::CodeObject
285
285
  # unless it later sees <tt>class Container</tt>. +add_class+ automatically
286
286
  # upgrades +given_name+ to a class in this case.
287
287
 
288
- def add_class class_type, given_name, superclass = '::Object'
288
+ def add_class(class_type, given_name, superclass = '::Object')
289
289
  # superclass +nil+ is passed by the C parser in the following cases:
290
290
  # - registering Object in 1.8 (correct)
291
291
  # - registering BasicObject in 1.9 (correct)
@@ -401,7 +401,7 @@ class RDoc::Context < RDoc::CodeObject
401
401
  # unless #done_documenting is +true+. Sets the #parent of +mod+
402
402
  # to +self+, and its #section to #current_section. Returns +mod+.
403
403
 
404
- def add_class_or_module mod, self_hash, all_hash
404
+ def add_class_or_module(mod, self_hash, all_hash)
405
405
  mod.section = current_section # TODO declaring context? something is
406
406
  # wrong here...
407
407
  mod.parent = self
@@ -426,7 +426,7 @@ class RDoc::Context < RDoc::CodeObject
426
426
  # Adds +constant+ if not already there. If it is, updates the comment,
427
427
  # value and/or is_alias_for of the known constant if they were empty/nil.
428
428
 
429
- def add_constant constant
429
+ def add_constant(constant)
430
430
  return constant unless @document_self
431
431
 
432
432
  # HACK: avoid duplicate 'PI' & 'E' in math.c (1.8.7 source code)
@@ -451,7 +451,7 @@ class RDoc::Context < RDoc::CodeObject
451
451
  ##
452
452
  # Adds included module +include+ which should be an RDoc::Include
453
453
 
454
- def add_include include
454
+ def add_include(include)
455
455
  add_to @includes, include
456
456
 
457
457
  include
@@ -460,7 +460,7 @@ class RDoc::Context < RDoc::CodeObject
460
460
  ##
461
461
  # Adds extension module +ext+ which should be an RDoc::Extend
462
462
 
463
- def add_extend ext
463
+ def add_extend(ext)
464
464
  add_to @extends, ext
465
465
 
466
466
  ext
@@ -470,7 +470,7 @@ class RDoc::Context < RDoc::CodeObject
470
470
  # Adds +method+ if not already there. If it is (as method or attribute),
471
471
  # updates the comment if it was empty.
472
472
 
473
- def add_method method
473
+ def add_method(method)
474
474
  return method unless @document_self
475
475
 
476
476
  # HACK: avoid duplicate 'new' in io.c & struct.c (1.8.7 source code)
@@ -524,7 +524,7 @@ class RDoc::Context < RDoc::CodeObject
524
524
  # Adds an alias from +from+ (a class or module) to +name+ which was defined
525
525
  # in +file+.
526
526
 
527
- def add_module_alias from, from_name, to, file
527
+ def add_module_alias(from, from_name, to, file)
528
528
  return from if @done_documenting
529
529
 
530
530
  to_full_name = child_name to.name
@@ -583,7 +583,7 @@ class RDoc::Context < RDoc::CodeObject
583
583
  #
584
584
  # See also RDoc::Context::Section
585
585
 
586
- def add_section title, comment = nil
586
+ def add_section(title, comment = nil)
587
587
  if section = @sections[title] then
588
588
  section.add_comment comment if comment
589
589
  else
@@ -597,7 +597,7 @@ class RDoc::Context < RDoc::CodeObject
597
597
  ##
598
598
  # Adds +thing+ to the collection +array+
599
599
 
600
- def add_to array, thing
600
+ def add_to(array, thing)
601
601
  array << thing if @document_self
602
602
 
603
603
  thing.parent = self
@@ -629,7 +629,7 @@ class RDoc::Context < RDoc::CodeObject
629
629
  ##
630
630
  # Creates the full name for a child with +name+
631
631
 
632
- def child_name name
632
+ def child_name(name)
633
633
  if name =~ /^:+/
634
634
  $' #'
635
635
  elsif RDoc::TopLevel === self then
@@ -970,7 +970,7 @@ class RDoc::Context < RDoc::CodeObject
970
970
  # If +section+ is provided only methods in that RDoc::Context::Section will
971
971
  # be returned.
972
972
 
973
- def methods_by_type section = nil
973
+ def methods_by_type(section = nil)
974
974
  methods = {}
975
975
 
976
976
  TYPES.each do |type|
@@ -1062,7 +1062,7 @@ class RDoc::Context < RDoc::CodeObject
1062
1062
  #--
1063
1063
  # TODO mark the visibility of attributes in the template (if not public?)
1064
1064
 
1065
- def remove_invisible min_visibility
1065
+ def remove_invisible(min_visibility)
1066
1066
  return if [:private, :nodoc].include? min_visibility
1067
1067
  remove_invisible_in @method_list, min_visibility
1068
1068
  remove_invisible_in @attributes, min_visibility
@@ -1072,7 +1072,7 @@ class RDoc::Context < RDoc::CodeObject
1072
1072
  ##
1073
1073
  # Only called when min_visibility == :public or :private
1074
1074
 
1075
- def remove_invisible_in array, min_visibility # :nodoc:
1075
+ def remove_invisible_in(array, min_visibility) # :nodoc:
1076
1076
  if min_visibility == :public then
1077
1077
  array.reject! { |e|
1078
1078
  e.visibility != :public and not e.force_documentation
@@ -1088,7 +1088,7 @@ class RDoc::Context < RDoc::CodeObject
1088
1088
  # Tries to resolve unmatched aliases when a method or attribute has just
1089
1089
  # been added.
1090
1090
 
1091
- def resolve_aliases added
1091
+ def resolve_aliases(added)
1092
1092
  # resolve any pending unmatched aliases
1093
1093
  key = added.pretty_name
1094
1094
  unmatched_alias_list = @unmatched_alias_lists[key]
@@ -1139,7 +1139,7 @@ class RDoc::Context < RDoc::CodeObject
1139
1139
  ##
1140
1140
  # Sets the current section to a section with +title+. See also #add_section
1141
1141
 
1142
- def set_current_section title, comment
1142
+ def set_current_section(title, comment)
1143
1143
  @current_section = add_section title, comment
1144
1144
  end
1145
1145
 
@@ -1204,7 +1204,7 @@ class RDoc::Context < RDoc::CodeObject
1204
1204
  ##
1205
1205
  # Upgrades NormalModule +mod+ in +enclosing+ to a +class_type+
1206
1206
 
1207
- def upgrade_to_class mod, class_type, enclosing
1207
+ def upgrade_to_class(mod, class_type, enclosing)
1208
1208
  enclosing.modules_hash.delete mod.name
1209
1209
 
1210
1210
  klass = RDoc::ClassModule.from_module class_type, mod
@@ -91,7 +91,7 @@ class RDoc::MethodAttr < RDoc::CodeObject
91
91
  ##
92
92
  # Resets cached data for the object so it can be rebuilt by accessor methods
93
93
 
94
- def initialize_copy other # :nodoc:
94
+ def initialize_copy(other) # :nodoc:
95
95
  @full_name = nil
96
96
  end
97
97
 
@@ -111,7 +111,7 @@ class RDoc::MethodAttr < RDoc::CodeObject
111
111
  [other.singleton ? 0 : 1, other.name_ord_range, other.name]
112
112
  end
113
113
 
114
- def == other # :nodoc:
114
+ def ==(other) # :nodoc:
115
115
  equal?(other) or self.class == other.class and full_name == other.full_name
116
116
  end
117
117
 
@@ -150,7 +150,7 @@ class RDoc::MethodAttr < RDoc::CodeObject
150
150
  ##
151
151
  # Sets the store for this class or module and its contained code objects.
152
152
 
153
- def store= store
153
+ def store=(store)
154
154
  super
155
155
 
156
156
  @file = @store.add_file @file.full_name if @file
@@ -168,7 +168,7 @@ class RDoc::MethodAttr < RDoc::CodeObject
168
168
  return find_method_or_attribute name[0..-2]
169
169
  end
170
170
 
171
- def find_method_or_attribute name # :nodoc:
171
+ def find_method_or_attribute(name) # :nodoc:
172
172
  return nil unless parent.respond_to? :ancestors
173
173
 
174
174
  searched = parent.ancestors
@@ -282,7 +282,8 @@ class RDoc::MethodAttr < RDoc::CodeObject
282
282
  # HTML id-friendly method/attribute name
283
283
 
284
284
  def html_name
285
- require 'cgi/util'
285
+ require 'cgi/escape'
286
+ require 'cgi/util' unless defined?(CGI::EscapeExt)
286
287
 
287
288
  CGI.escape(@name.gsub('-', '-2D')).gsub('%', '-').sub(/^-/, '')
288
289
  end
@@ -341,7 +342,7 @@ class RDoc::MethodAttr < RDoc::CodeObject
341
342
  @parent_name || super
342
343
  end
343
344
 
344
- def pretty_print q # :nodoc:
345
+ def pretty_print(q) # :nodoc:
345
346
  alias_for =
346
347
  if @is_alias_for.respond_to? :name then
347
348
  "alias for #{@is_alias_for.name}"