Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nasty problem upgrading to 0.9.28 #1465

Open
mcorino opened this issue Nov 8, 2022 · 0 comments
Open

Nasty problem upgrading to 0.9.28 #1465

mcorino opened this issue Nov 8, 2022 · 0 comments

Comments

@mcorino
Copy link

mcorino commented Nov 8, 2022

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:

  1. Save the example above to some file
  2. Run the following command: yardoc <file>
  3. Open browser to the generated index.html file
  4. Click on the 'Top' module link.
  5. 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]
  • YARD version (yard -v): yard 0.9.28

I have read the Contributing Guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant