@@ -289,18 +289,16 @@ def handle_meta_method_comment(comment, node)
289289
290290 if attributes
291291 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 )
293293 a . store = @store
294294 a . line = line_no
295- a . singleton = @singleton
296295 record_location ( a )
297296 @container . add_attribute ( a )
298297 a . visibility = visibility
299298 end
300299 elsif line_no || node
301300 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 )
304302 handle_consecutive_comment_directive ( meth , comment )
305303 comment . normalize
306304 meth . call_seq = comment . extract_call_seq
@@ -316,7 +314,6 @@ def handle_meta_method_comment(comment, node)
316314 meth ,
317315 line_no : line_no ,
318316 visibility : visibility ,
319- singleton : @singleton || singleton_method ,
320317 params : '()' ,
321318 calls_super : false ,
322319 block_params : nil ,
@@ -452,8 +449,7 @@ def add_alias_method(old_name, new_name, line_no)
452449 comment = consecutive_comment ( line_no )
453450 handle_consecutive_comment_directive ( @container , comment )
454451 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 )
457453 handle_modifier_directive ( a , line_no )
458454 a . store = @store
459455 a . line = line_no
@@ -472,10 +468,9 @@ def add_attributes(names, rw, line_no)
472468 return unless @container . document_children
473469
474470 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 )
476472 a . store = @store
477473 a . line = line_no
478- a . singleton = @singleton
479474 record_location ( a )
480475 handle_modifier_directive ( a , line_no )
481476 @container . add_attribute ( a ) if should_document? ( a )
@@ -514,7 +509,7 @@ def add_method(name, receiver_name:, receiver_fallback_type:, visibility:, singl
514509 return if @in_proc_block
515510
516511 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 )
518513 if ( comment = consecutive_comment ( start_line ) )
519514 handle_consecutive_comment_directive ( @container , comment )
520515 handle_consecutive_comment_directive ( meth , comment )
@@ -533,7 +528,6 @@ def add_method(name, receiver_name:, receiver_fallback_type:, visibility:, singl
533528 meth ,
534529 line_no : start_line ,
535530 visibility : visibility ,
536- singleton : singleton ,
537531 params : params ,
538532 calls_super : calls_super ,
539533 block_params : block_params ,
@@ -553,12 +547,11 @@ def add_method(name, receiver_name:, receiver_fallback_type:, visibility:, singl
553547 end
554548 end
555549
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:
557551 meth . name ||= meth . call_seq [ /\A [^()\s ]+/ ] if meth . call_seq
558552 meth . name ||= 'unknown'
559553 meth . store = @store
560554 meth . line = line_no
561- meth . singleton = singleton
562555 container . add_method ( meth ) # should add after setting singleton and before setting visibility
563556 meth . visibility = visibility
564557 meth . params ||= params
0 commit comments