@@ -289,18 +289,16 @@ def handle_meta_method_comment(comment, node)
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
304
meth . call_seq = comment . extract_call_seq
@@ -316,7 +314,6 @@ def handle_meta_method_comment(comment, node)
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 @@ def add_alias_method(old_name, new_name, line_no)
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 @@ def add_attributes(names, rw, line_no)
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,7 +509,7 @@ def add_method(name, receiver_name:, receiver_fallback_type:, visibility:, singl
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 )
@@ -533,7 +528,6 @@ def add_method(name, receiver_name:, receiver_fallback_type:, visibility:, singl
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 @@ def add_method(name, receiver_name:, receiver_fallback_type:, visibility:, singl
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
0 commit comments