@@ -46,8 +46,7 @@ def process_def(def_node)
4646
4747 sig { params ( attr_node : YARD ::Parser ::Ruby ::MethodCallNode ) . void }
4848 def process_attr ( attr_node )
49- names = NodeUtils . validated_attribute_names ( attr_node )
50- return if merged_into_attr? ( attr_node , names )
49+ return if merged_into_attr? ( attr_node )
5150
5251 parse_node ( attr_node , statement . docstring , include_params : false )
5352 statement . docstring = nil
@@ -56,18 +55,24 @@ def process_attr(attr_node)
5655 # An attr* sig can be merged into a previous attr* docstring if it is the only parameter passed to the attr*
5756 # declaration. This is to avoid needing to rewrite the source code to separate merged and unmerged attr*
5857 # declarations.
59- sig { params ( attr_node : YARD ::Parser ::Ruby ::MethodCallNode , names : T ::Array [ String ] ) . returns ( T ::Boolean ) }
60- def merged_into_attr? ( attr_node , names )
61- return false if names . size == 1
58+ sig { params ( attr_node : YARD ::Parser ::Ruby ::MethodCallNode ) . returns ( T ::Boolean ) }
59+ def merged_into_attr? ( attr_node )
60+ names = NodeUtils . validated_attribute_names ( attr_node )
61+ return false if names . size != 1
6262
6363 nodes = namespace . attributes [ scope ] [ names . fetch ( 0 ) ]
6464 return false if nodes . nil? || nodes . empty?
6565
66- nodes . each_value { parse_node ( _1 , _1 . docstring , include_params : false ) }
66+ document_attr_methods ( nodes . values . compact )
6767 attr_node . docstring = statement . docstring = nil
6868 true
6969 end
7070
71+ sig { params ( method_objects : T ::Array [ YARD ::CodeObjects ::MethodObject ] ) . void }
72+ def document_attr_methods ( method_objects )
73+ method_objects . each { parse_node ( _1 , _1 . docstring , include_params : false ) }
74+ end
75+
7176 sig { params ( attach_to : Documentable , docstring : T . nilable ( String ) , include_params : T ::Boolean ) . void }
7277 def parse_node ( attach_to , docstring , include_params : true )
7378 docstring_ , directives = Directives . extract_directives ( docstring )
0 commit comments