rdoc 6.12.0 → 6.14.1

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 (100) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +3 -1
  3. data/lib/rdoc/code_object/alias.rb +2 -9
  4. data/lib/rdoc/code_object/any_method.rb +9 -14
  5. data/lib/rdoc/code_object/attr.rb +6 -9
  6. data/lib/rdoc/code_object/class_module.rb +40 -23
  7. data/lib/rdoc/code_object/constant.rb +5 -5
  8. data/lib/rdoc/code_object/context/section.rb +8 -7
  9. data/lib/rdoc/code_object/context.rb +23 -65
  10. data/lib/rdoc/code_object/method_attr.rb +9 -28
  11. data/lib/rdoc/code_object/mixin.rb +3 -3
  12. data/lib/rdoc/code_object/normal_class.rb +1 -1
  13. data/lib/rdoc/code_object/normal_module.rb +1 -1
  14. data/lib/rdoc/code_object/require.rb +1 -1
  15. data/lib/rdoc/code_object/single_class.rb +1 -1
  16. data/lib/rdoc/code_object/top_level.rb +12 -30
  17. data/lib/rdoc/code_object.rb +6 -37
  18. data/lib/rdoc/comment.rb +7 -10
  19. data/lib/rdoc/cross_reference.rb +3 -3
  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/darkfish.rb +97 -109
  24. data/lib/rdoc/generator/json_index.rb +4 -20
  25. data/lib/rdoc/generator/markup.rb +14 -2
  26. data/lib/rdoc/generator/pot/message_extractor.rb +6 -6
  27. data/lib/rdoc/generator/pot/po.rb +1 -1
  28. data/lib/rdoc/generator/pot/po_entry.rb +7 -7
  29. data/lib/rdoc/generator/pot.rb +1 -6
  30. data/lib/rdoc/generator/ri.rb +1 -1
  31. data/lib/rdoc/generator/template/darkfish/_head.rhtml +5 -0
  32. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -30
  33. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +1 -1
  34. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +1 -1
  35. data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -0
  36. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +15 -0
  37. data/lib/rdoc/markdown.kpeg +7 -5
  38. data/lib/rdoc/markdown.rb +34 -21
  39. data/lib/rdoc/markup/attribute_manager.rb +5 -5
  40. data/lib/rdoc/markup/attributes.rb +3 -3
  41. data/lib/rdoc/markup/blank_line.rb +2 -2
  42. data/lib/rdoc/markup/block_quote.rb +1 -1
  43. data/lib/rdoc/markup/document.rb +8 -8
  44. data/lib/rdoc/markup/formatter.rb +12 -12
  45. data/lib/rdoc/markup/hard_break.rb +3 -3
  46. data/lib/rdoc/markup/heading.rb +11 -5
  47. data/lib/rdoc/markup/include.rb +3 -3
  48. data/lib/rdoc/markup/indented_paragraph.rb +3 -3
  49. data/lib/rdoc/markup/list.rb +4 -4
  50. data/lib/rdoc/markup/list_item.rb +4 -4
  51. data/lib/rdoc/markup/paragraph.rb +2 -2
  52. data/lib/rdoc/markup/parser.rb +11 -11
  53. data/lib/rdoc/markup/pre_process.rb +6 -6
  54. data/lib/rdoc/markup/raw.rb +5 -5
  55. data/lib/rdoc/markup/rule.rb +2 -2
  56. data/lib/rdoc/markup/table.rb +4 -4
  57. data/lib/rdoc/markup/to_ansi.rb +3 -3
  58. data/lib/rdoc/markup/to_bs.rb +6 -6
  59. data/lib/rdoc/markup/to_html.rb +25 -16
  60. data/lib/rdoc/markup/to_html_crossref.rb +5 -5
  61. data/lib/rdoc/markup/to_html_snippet.rb +17 -17
  62. data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
  63. data/lib/rdoc/markup/to_label.rb +6 -5
  64. data/lib/rdoc/markup/to_markdown.rb +12 -12
  65. data/lib/rdoc/markup/to_rdoc.rb +29 -28
  66. data/lib/rdoc/markup/to_table_of_contents.rb +3 -3
  67. data/lib/rdoc/markup/to_test.rb +1 -1
  68. data/lib/rdoc/markup/to_tt_only.rb +8 -8
  69. data/lib/rdoc/markup/verbatim.rb +3 -3
  70. data/lib/rdoc/markup.rb +3 -3
  71. data/lib/rdoc/options.rb +31 -12
  72. data/lib/rdoc/parser/c.rb +20 -23
  73. data/lib/rdoc/parser/changelog.rb +9 -9
  74. data/lib/rdoc/parser/prism_ruby.rb +9 -16
  75. data/lib/rdoc/parser/ruby.rb +50 -53
  76. data/lib/rdoc/parser/simple.rb +2 -2
  77. data/lib/rdoc/parser.rb +8 -8
  78. data/lib/rdoc/rd/inline.rb +4 -4
  79. data/lib/rdoc/rd.rb +1 -1
  80. data/lib/rdoc/rdoc.rb +11 -26
  81. data/lib/rdoc/ri/driver.rb +60 -52
  82. data/lib/rdoc/ri/paths.rb +2 -2
  83. data/lib/rdoc/ri/task.rb +1 -1
  84. data/lib/rdoc/rubygems_hook.rb +14 -17
  85. data/lib/rdoc/servlet.rb +23 -22
  86. data/lib/rdoc/stats/normal.rb +1 -1
  87. data/lib/rdoc/stats/quiet.rb +1 -1
  88. data/lib/rdoc/stats/verbose.rb +3 -3
  89. data/lib/rdoc/stats.rb +14 -14
  90. data/lib/rdoc/store.rb +39 -43
  91. data/lib/rdoc/task.rb +2 -2
  92. data/lib/rdoc/text.rb +13 -13
  93. data/lib/rdoc/token_stream.rb +1 -1
  94. data/lib/rdoc/tom_doc.rb +7 -7
  95. data/lib/rdoc/version.rb +1 -1
  96. data/man/ri.1 +2 -0
  97. data/rdoc.gemspec +69 -0
  98. metadata +18 -5
  99. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
  100. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
data/lib/rdoc/options.rb CHANGED
@@ -363,7 +363,22 @@ class RDoc::Options
363
363
  # Words to be ignored in autolink cross-references
364
364
  attr_accessor :autolink_excluded_words
365
365
 
366
- def initialize loaded_options = nil # :nodoc:
366
+ ##
367
+ # The prefix to use for class and module page paths
368
+
369
+ attr_accessor :class_module_path_prefix
370
+
371
+ ##
372
+ # The prefix to use for file page paths
373
+
374
+ attr_accessor :file_path_prefix
375
+
376
+ ##
377
+ # The preferred root URL for the documentation
378
+
379
+ attr_accessor :canonical_root
380
+
381
+ def initialize(loaded_options = nil) # :nodoc:
367
382
  init_ivars
368
383
  override loaded_options if loaded_options
369
384
  end
@@ -417,9 +432,12 @@ class RDoc::Options
417
432
  @charset = @encoding.name
418
433
  @skip_tests = true
419
434
  @apply_default_exclude = true
435
+ @class_module_path_prefix = nil
436
+ @file_path_prefix = nil
437
+ @canonical_root = nil
420
438
  end
421
439
 
422
- def init_with map # :nodoc:
440
+ def init_with(map) # :nodoc:
423
441
  init_ivars
424
442
 
425
443
  encoding = map['encoding']
@@ -450,11 +468,11 @@ class RDoc::Options
450
468
  @static_path = sanitize_path map['static_path']
451
469
  end
452
470
 
453
- def yaml_initialize tag, map # :nodoc:
471
+ def yaml_initialize(tag, map) # :nodoc:
454
472
  init_with map
455
473
  end
456
474
 
457
- def override map # :nodoc:
475
+ def override(map) # :nodoc:
458
476
  if map.has_key?('encoding')
459
477
  encoding = map['encoding']
460
478
  @encoding = encoding ? Encoding.find(encoding) : encoding
@@ -480,6 +498,7 @@ class RDoc::Options
480
498
  @webcvs = map['webcvs'] if map.has_key?('webcvs')
481
499
  @autolink_excluded_words = map['autolink_excluded_words'] if map.has_key?('autolink_excluded_words')
482
500
  @apply_default_exclude = map['apply_default_exclude'] if map.has_key?('apply_default_exclude')
501
+ @canonical_root = map['canonical_root'] if map.has_key?('canonical_root')
483
502
 
484
503
  @warn_missing_rdoc_ref = map['warn_missing_rdoc_ref'] if map.has_key?('warn_missing_rdoc_ref')
485
504
 
@@ -491,7 +510,7 @@ class RDoc::Options
491
510
  end
492
511
  end
493
512
 
494
- def == other # :nodoc:
513
+ def ==(other) # :nodoc:
495
514
  self.class === other and
496
515
  @encoding == other.encoding and
497
516
  @embed_mixins == other.embed_mixins and
@@ -683,7 +702,7 @@ class RDoc::Options
683
702
  ##
684
703
  # Parses command line options.
685
704
 
686
- def parse argv
705
+ def parse(argv)
687
706
  ignore_invalid = true
688
707
 
689
708
  argv.insert(0, *ENV['RDOCOPT'].split) if ENV['RDOCOPT']
@@ -1262,14 +1281,14 @@ Usage: #{opt.program_name} [options] [names...]
1262
1281
  ##
1263
1282
  # Set quietness to +bool+
1264
1283
 
1265
- def quiet= bool
1284
+ def quiet=(bool)
1266
1285
  @verbosity = bool ? 0 : 1
1267
1286
  end
1268
1287
 
1269
1288
  ##
1270
1289
  # Removes directories from +path+ that are outside the current directory
1271
1290
 
1272
- def sanitize_path path
1291
+ def sanitize_path(path)
1273
1292
  require 'pathname'
1274
1293
  dot = Pathname.new('.').expand_path
1275
1294
 
@@ -1296,7 +1315,7 @@ Usage: #{opt.program_name} [options] [names...]
1296
1315
  # the options instance. This allows generators to add custom options or set
1297
1316
  # default options.
1298
1317
 
1299
- def setup_generator generator_name = @generator_name
1318
+ def setup_generator(generator_name = @generator_name)
1300
1319
  @generator = @generators[generator_name]
1301
1320
 
1302
1321
  unless @generator then
@@ -1318,7 +1337,7 @@ Usage: #{opt.program_name} [options] [names...]
1318
1337
  ##
1319
1338
  # Finds the template dir for +template+
1320
1339
 
1321
- def template_dir_for template
1340
+ def template_dir_for(template)
1322
1341
  template_path = File.join 'rdoc', 'generator', 'template', template
1323
1342
 
1324
1343
  $LOAD_PATH.map do |path|
@@ -1335,7 +1354,7 @@ Usage: #{opt.program_name} [options] [names...]
1335
1354
  # When +:all+ is passed, visibility is set to +:private+, similarly to
1336
1355
  # RDOCOPT="--all", see #visibility for more information.
1337
1356
 
1338
- def visibility= visibility
1357
+ def visibility=(visibility)
1339
1358
  case visibility
1340
1359
  when :all
1341
1360
  @visibility = :private
@@ -1347,7 +1366,7 @@ Usage: #{opt.program_name} [options] [names...]
1347
1366
  ##
1348
1367
  # Displays a warning using Kernel#warn if we're being verbose
1349
1368
 
1350
- def warn message
1369
+ def warn(message)
1351
1370
  super message if @verbosity > 1
1352
1371
  end
1353
1372
 
data/lib/rdoc/parser/c.rb CHANGED
@@ -168,7 +168,7 @@ class RDoc::Parser::C < RDoc::Parser
168
168
  # Prepares for parsing a C file. See RDoc::Parser#initialize for details on
169
169
  # the arguments.
170
170
 
171
- def initialize top_level, content, options, stats
171
+ def initialize(top_level, content, options, stats)
172
172
  super
173
173
 
174
174
  @known_classes = RDoc::KNOWN_CLASSES.dup
@@ -193,7 +193,7 @@ class RDoc::Parser::C < RDoc::Parser
193
193
 
194
194
  @enclosure_dependencies.extend TSort
195
195
 
196
- def @enclosure_dependencies.tsort_each_node &block
196
+ def @enclosure_dependencies.tsort_each_node(&block)
197
197
  each_key(&block)
198
198
  rescue TSort::Cyclic => e
199
199
  cycle_vars = e.message.scan(/"(.*?)"/).flatten
@@ -211,7 +211,7 @@ class RDoc::Parser::C < RDoc::Parser
211
211
  retry
212
212
  end
213
213
 
214
- def @enclosure_dependencies.tsort_each_child node, &block
214
+ def @enclosure_dependencies.tsort_each_child(node, &block)
215
215
  fetch(node, []).each(&block)
216
216
  end
217
217
  end
@@ -248,9 +248,7 @@ class RDoc::Parser::C < RDoc::Parser
248
248
  # method that reference the same function.
249
249
 
250
250
  def add_alias(var_name, class_obj, old_name, new_name, comment)
251
- al = RDoc::Alias.new '', old_name, new_name, ''
252
- al.singleton = @singleton_classes.key? var_name
253
- al.comment = comment
251
+ al = RDoc::Alias.new '', old_name, new_name, comment, singleton: @singleton_classes.key?(var_name)
254
252
  al.record_location @top_level
255
253
  class_obj.add_alias al
256
254
  @stats.add_alias al
@@ -521,7 +519,7 @@ class RDoc::Parser::C < RDoc::Parser
521
519
  # Finds the comment for an alias on +class_name+ from +new_name+ to
522
520
  # +old_name+
523
521
 
524
- def find_alias_comment class_name, new_name, old_name
522
+ def find_alias_comment(class_name, new_name, old_name)
525
523
  content =~ %r%((?>/\*.*?\*/\s+))
526
524
  rb_define_alias\(\s*#{Regexp.escape class_name}\s*,
527
525
  \s*"#{Regexp.escape new_name}"\s*,
@@ -539,7 +537,7 @@ class RDoc::Parser::C < RDoc::Parser
539
537
  # +read+ and +write+ are the read/write flags ('1' or '0'). Either both or
540
538
  # neither must be provided.
541
539
 
542
- def find_attr_comment var_name, attr_name, read = nil, write = nil
540
+ def find_attr_comment(var_name, attr_name, read = nil, write = nil)
543
541
  attr_name = Regexp.escape attr_name
544
542
 
545
543
  rw = if read and write then
@@ -572,7 +570,7 @@ class RDoc::Parser::C < RDoc::Parser
572
570
  ##
573
571
  # Generate a Ruby-method table
574
572
 
575
- def gen_body_table file_content
573
+ def gen_body_table(file_content)
576
574
  table = {}
577
575
  file_content.scan(%r{
578
576
  ((?>/\*.*?\*/\s*)?)
@@ -596,7 +594,7 @@ class RDoc::Parser::C < RDoc::Parser
596
594
  ##
597
595
  # Find the C code corresponding to a Ruby method
598
596
 
599
- def find_body class_name, meth_name, meth_obj, file_content, quiet = false
597
+ def find_body(class_name, meth_name, meth_obj, file_content, quiet = false)
600
598
  if file_content
601
599
  @body_table ||= {}
602
600
  @body_table[file_content] ||= gen_body_table file_content
@@ -721,7 +719,7 @@ class RDoc::Parser::C < RDoc::Parser
721
719
  # */
722
720
  # VALUE cFoo = rb_define_class("Foo", rb_cObject);
723
721
 
724
- def find_class_comment class_name, class_mod
722
+ def find_class_comment(class_name, class_mod)
725
723
  comment = nil
726
724
 
727
725
  if @content =~ %r%
@@ -754,7 +752,7 @@ class RDoc::Parser::C < RDoc::Parser
754
752
  ##
755
753
  # Generate a const table
756
754
 
757
- def gen_const_table file_content
755
+ def gen_const_table(file_content)
758
756
  table = {}
759
757
  @content.scan(%r{
760
758
  (?<doc>(?>^\s*/\*.*?\*/\s+))
@@ -808,9 +806,9 @@ class RDoc::Parser::C < RDoc::Parser
808
806
  ##
809
807
  # Handles modifiers in +comment+ and updates +meth_obj+ as appropriate.
810
808
 
811
- def find_modifiers comment, meth_obj
809
+ def find_modifiers(comment, meth_obj)
812
810
  comment.normalize
813
- comment.extract_call_seq meth_obj
811
+ meth_obj.call_seq = comment.extract_call_seq
814
812
 
815
813
  look_for_directives_in meth_obj, comment
816
814
  end
@@ -818,7 +816,7 @@ class RDoc::Parser::C < RDoc::Parser
818
816
  ##
819
817
  # Finds a <tt>Document-method</tt> override for +meth_obj+ on +class_name+
820
818
 
821
- def find_override_comment class_name, meth_obj
819
+ def find_override_comment(class_name, meth_obj)
822
820
  name = Regexp.escape meth_obj.name
823
821
  prefix = Regexp.escape meth_obj.name_prefix
824
822
 
@@ -1015,10 +1013,9 @@ class RDoc::Parser::C < RDoc::Parser
1015
1013
  type = 'method' # force public
1016
1014
  end
1017
1015
 
1018
- meth_obj = RDoc::AnyMethod.new '', meth_name
1016
+ singleton = singleton || %w[singleton_method module_function].include?(type)
1017
+ meth_obj = RDoc::AnyMethod.new '', meth_name, singleton: singleton
1019
1018
  meth_obj.c_function = function
1020
- meth_obj.singleton =
1021
- singleton || %w[singleton_method module_function].include?(type)
1022
1019
 
1023
1020
  p_count = Integer(param_count) rescue -1
1024
1021
 
@@ -1063,7 +1060,7 @@ class RDoc::Parser::C < RDoc::Parser
1063
1060
  ##
1064
1061
  # Registers a singleton class +sclass_var+ as a singleton of +class_var+
1065
1062
 
1066
- def handle_singleton sclass_var, class_var
1063
+ def handle_singleton(sclass_var, class_var)
1067
1064
  class_name = @known_classes[class_var]
1068
1065
 
1069
1066
  @known_classes[sclass_var] = class_name
@@ -1074,7 +1071,7 @@ class RDoc::Parser::C < RDoc::Parser
1074
1071
  # Loads the variable map with the given +name+ from the RDoc::Store, if
1075
1072
  # present.
1076
1073
 
1077
- def load_variable_map map_name
1074
+ def load_variable_map(map_name)
1078
1075
  return {} unless files = @store.cache[map_name]
1079
1076
  return {} unless name_map = files[@file_name]
1080
1077
 
@@ -1104,7 +1101,7 @@ class RDoc::Parser::C < RDoc::Parser
1104
1101
  # This method modifies the +comment+
1105
1102
  # Both :main: and :title: directives are deprecated and will be removed in RDoc 7.
1106
1103
 
1107
- def look_for_directives_in context, comment
1104
+ def look_for_directives_in(context, comment)
1108
1105
  @preprocess.handle comment, context do |directive, param|
1109
1106
  case directive
1110
1107
  when 'main' then
@@ -1141,7 +1138,7 @@ class RDoc::Parser::C < RDoc::Parser
1141
1138
  # Extracts parameters from the +method_body+ and returns a method
1142
1139
  # parameter string. Follows 1.9.3dev's scan-arg-spec, see README.EXT
1143
1140
 
1144
- def rb_scan_args method_body
1141
+ def rb_scan_args(method_body)
1145
1142
  method_body =~ /rb_scan_args\((.*?)\)/m
1146
1143
  return '(*args)' unless $1
1147
1144
 
@@ -1252,7 +1249,7 @@ class RDoc::Parser::C < RDoc::Parser
1252
1249
  ##
1253
1250
  # Creates a RDoc::Comment instance.
1254
1251
 
1255
- def new_comment text = nil, location = nil, language = nil
1252
+ def new_comment(text = nil, location = nil, language = nil)
1256
1253
  RDoc::Comment.new(text, location, language).tap do |comment|
1257
1254
  comment.format = @markup
1258
1255
  end
@@ -23,7 +23,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
23
23
  # Continued function listings are joined together as a single entry.
24
24
  # Continued descriptions are joined to make a single paragraph.
25
25
 
26
- def continue_entry_body entry_body, continuation
26
+ def continue_entry_body(entry_body, continuation)
27
27
  return unless last = entry_body.last
28
28
 
29
29
  if last =~ /\)\s*\z/ and continuation =~ /\A\(/ then
@@ -41,7 +41,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
41
41
  ##
42
42
  # Creates an RDoc::Markup::Document given the +groups+ of ChangeLog entries.
43
43
 
44
- def create_document groups
44
+ def create_document(groups)
45
45
  doc = RDoc::Markup::Document.new
46
46
  doc.omit_headings_below = 2
47
47
  doc.file = @top_level
@@ -63,7 +63,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
63
63
  # Returns a list of ChangeLog entries an RDoc::Markup nodes for the given
64
64
  # +entries+.
65
65
 
66
- def create_entries entries
66
+ def create_entries(entries)
67
67
  out = []
68
68
 
69
69
  entries.each do |entry, items|
@@ -80,7 +80,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
80
80
  # Returns an RDoc::Markup::List containing the given +items+ in the
81
81
  # ChangeLog
82
82
 
83
- def create_items items
83
+ def create_items(items)
84
84
  list = RDoc::Markup::List.new :NOTE
85
85
 
86
86
  items.each do |item|
@@ -100,7 +100,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
100
100
  ##
101
101
  # Groups +entries+ by date.
102
102
 
103
- def group_entries entries
103
+ def group_entries(entries)
104
104
  @time_cache ||= {}
105
105
  entries.group_by do |title, _|
106
106
  begin
@@ -260,7 +260,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
260
260
  # RDoc::Parser::ChangeLog::Git::LogEntry list for the given
261
261
  # +entries+.
262
262
 
263
- def create_entries entries
263
+ def create_entries(entries)
264
264
  # git log entries have no strictly itemized style like the old
265
265
  # style, just assume Markdown.
266
266
  entries.map do |commit, entry|
@@ -296,7 +296,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
296
296
  "label-#{commit}"
297
297
  end
298
298
 
299
- def label context = nil
299
+ def label(context = nil)
300
300
  aref
301
301
  end
302
302
 
@@ -311,7 +311,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
311
311
  end + " {#{author}}[mailto:#{email}]"
312
312
  end
313
313
 
314
- def accept visitor
314
+ def accept(visitor)
315
315
  visitor.accept_heading self
316
316
  begin
317
317
  if visitor.respond_to?(:code_object=)
@@ -328,7 +328,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
328
328
  end
329
329
  end
330
330
 
331
- def pretty_print q # :nodoc:
331
+ def pretty_print(q) # :nodoc:
332
332
  q.group(2, '[log_entry: ', ']') do
333
333
  q.text commit
334
334
  q.text ','
@@ -77,7 +77,7 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
77
77
  # Records the location of this +container+ in the file for this parser and
78
78
  # adds it to the list of classes and modules in the file.
79
79
 
80
- def record_location container # :nodoc:
80
+ def record_location(container) # :nodoc:
81
81
  case container
82
82
  when RDoc::ClassModule then
83
83
  @top_level.add_to_classes_or_modules container
@@ -289,21 +289,19 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
289
289
 
290
290
  if attributes
291
291
  attributes.each do |attr|
292
- a = RDoc::Attr.new(@container, attr, rw, processed_comment)
292
+ a = RDoc::Attr.new(@container, attr, rw, processed_comment, singleton: @singleton)
293
293
  a.store = @store
294
294
  a.line = line_no
295
- a.singleton = @singleton
296
295
  record_location(a)
297
296
  @container.add_attribute(a)
298
297
  a.visibility = visibility
299
298
  end
300
299
  elsif line_no || node
301
300
  method_name ||= call_node_name_arguments(node).first if is_call_node
302
- meth = RDoc::AnyMethod.new(@container, method_name)
303
- meth.singleton = @singleton || singleton_method
301
+ meth = RDoc::AnyMethod.new(@container, method_name, singleton: @singleton || singleton_method)
304
302
  handle_consecutive_comment_directive(meth, comment)
305
303
  comment.normalize
306
- comment.extract_call_seq(meth)
304
+ meth.call_seq = comment.extract_call_seq
307
305
  meth.comment = comment
308
306
  if node
309
307
  tokens = visible_tokens_from_location(node.location)
@@ -316,7 +314,6 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
316
314
  meth,
317
315
  line_no: line_no,
318
316
  visibility: visibility,
319
- singleton: @singleton || singleton_method,
320
317
  params: '()',
321
318
  calls_super: false,
322
319
  block_params: nil,
@@ -452,8 +449,7 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
452
449
  comment = consecutive_comment(line_no)
453
450
  handle_consecutive_comment_directive(@container, comment)
454
451
  visibility = @container.find_method(old_name, @singleton)&.visibility || :public
455
- a = RDoc::Alias.new(nil, old_name, new_name, comment, @singleton)
456
- a.comment = comment
452
+ a = RDoc::Alias.new(nil, old_name, new_name, comment, singleton: @singleton)
457
453
  handle_modifier_directive(a, line_no)
458
454
  a.store = @store
459
455
  a.line = line_no
@@ -472,10 +468,9 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
472
468
  return unless @container.document_children
473
469
 
474
470
  names.each do |symbol|
475
- a = RDoc::Attr.new(nil, symbol.to_s, rw, comment)
471
+ a = RDoc::Attr.new(nil, symbol.to_s, rw, comment, singleton: @singleton)
476
472
  a.store = @store
477
473
  a.line = line_no
478
- a.singleton = @singleton
479
474
  record_location(a)
480
475
  handle_modifier_directive(a, line_no)
481
476
  @container.add_attribute(a) if should_document?(a)
@@ -514,13 +509,13 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
514
509
  return if @in_proc_block
515
510
 
516
511
  receiver = receiver_name ? find_or_create_module_path(receiver_name, receiver_fallback_type) : @container
517
- meth = RDoc::AnyMethod.new(nil, name)
512
+ meth = RDoc::AnyMethod.new(nil, name, singleton: singleton)
518
513
  if (comment = consecutive_comment(start_line))
519
514
  handle_consecutive_comment_directive(@container, comment)
520
515
  handle_consecutive_comment_directive(meth, comment)
521
516
 
522
517
  comment.normalize
523
- comment.extract_call_seq(meth)
518
+ meth.call_seq = comment.extract_call_seq
524
519
  meth.comment = comment
525
520
  end
526
521
  handle_modifier_directive(meth, start_line)
@@ -533,7 +528,6 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
533
528
  meth,
534
529
  line_no: start_line,
535
530
  visibility: visibility,
536
- singleton: singleton,
537
531
  params: params,
538
532
  calls_super: calls_super,
539
533
  block_params: block_params,
@@ -553,12 +547,11 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
553
547
  end
554
548
  end
555
549
 
556
- private def internal_add_method(container, meth, line_no:, visibility:, singleton:, params:, calls_super:, block_params:, tokens:) # :nodoc:
550
+ private def internal_add_method(container, meth, line_no:, visibility:, params:, calls_super:, block_params:, tokens:) # :nodoc:
557
551
  meth.name ||= meth.call_seq[/\A[^()\s]+/] if meth.call_seq
558
552
  meth.name ||= 'unknown'
559
553
  meth.store = @store
560
554
  meth.line = line_no
561
- meth.singleton = singleton
562
555
  container.add_method(meth) # should add after setting singleton and before setting visibility
563
556
  meth.visibility = visibility
564
557
  meth.params ||= params