I am documenting a native C-Ruby extension with files much like this:
# -----------------
# - Just comment
# -----------------
module Top
# Test class
#
class Test < Object
# @!method test(*args)
# @overload test(i, b)
# @param i [Integer] an integer
# @param b [Boolean] a boolean
# @overload test(s='')
# @param s [String] a string
#
# Method with overloads
# @!method ::new
# default constructor
end
end
This worked just fine with Ruby 2.5 and yard 0.9.12 but since I upgraded to Ruby 3.1.2 and yard 0.9.28 I have a nasty problem with the
generated documentation in that ALL methods of classes like class Test above are generated as members of the module Top instead of class Test.
Weirdly I found that when the class declaration contains any non-commented statement like:
module Top
# Test class
#
class Test
# ...
self
end
end
the documentation gets generated correctly. This is however a workaround I would be not happy about to have to apply.
Steps to reproduce
This is the minimal reproduction for the issue. I've done my best to remove
all extraneous code and unique environment state on my machine before providing
these steps:
Save the example above to some file
Run the following command: yardoc <file>
Open browser to the generated index.html file
Click on the 'Top' module link.
Click on the 'Test' class link
Actual Output
Methods listed under top module.
Expected Output
Methods listed under class where thery are documented.
Environment details:
OS: OpenSuSE Leap 15.4
Ruby version (ruby -v): ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
I am documenting a native C-Ruby extension with files much like this:
This worked just fine with Ruby 2.5 and yard 0.9.12 but since I upgraded to Ruby 3.1.2 and yard 0.9.28 I have a nasty problem with the generated documentation in that ALL methods of classes like
class Test
above are generated as members of themodule Top
instead ofclass Test
.Weirdly I found that when the class declaration contains any non-commented statement like:
the documentation gets generated correctly. This is however a workaround I would be not happy about to have to apply.
Steps to reproduce
This is the minimal reproduction for the issue. I've done my best to remove all extraneous code and unique environment state on my machine before providing these steps:
yardoc <file>
Actual Output
Methods listed under top module.
Expected Output
Methods listed under class where thery are documented.
Environment details:
ruby -v
): ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]yard -v
): yard 0.9.28I have read the Contributing Guide.