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

@!scope class behaviour not following docs example for "set of methods" scope #1411

Closed
qortex opened this issue Oct 27, 2021 · 1 comment
Closed

Comments

@qortex
Copy link

qortex commented Oct 27, 2021

Docs here states that this should mark method1 & method2 as class methods:

# @!scope class

# Documentation for method1
def method1; end

# Documentation for method2
def method2; end

In my experience, this doesn't work and @!scope class must be repeated on all methods definitions

Steps to reproduce

Repro:

class Test
  def test_instance; end

  # @!scope class

  # method1 doc
  def method1; end

  # method2 doc
  def method2; end
end

class Test2
  def test_instance; end

  # @!scope class

  def method1; end

  def method2; end
end

class Test3
  def test_instance; end

  # method1 doc
  # @!scope class
  def method1; end

  # method2 doc
  # @!scope class
  def method2; end
end

Actual Output

image

image

image

Expected Output

I would expect Test & Test2 to behave the same, with Test2 methods having no doc.

I would expect Test & Test2 to have method1 & method2 as class methods.

I would expect Test & Test3 to have the same doc.

Environment details:

  • OS: Fedora 34
  • Ruby version (ruby -v): ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]
  • YARD version (yard -v): yard 0.9.26

I have read the Contributing Guide.

@lsegal lsegal closed this as completed in a4f0fcc Nov 29, 2021
@lsegal
Copy link
Owner

lsegal commented Nov 29, 2021

Thanks for the report! This is fixed in the above commit and will be in the next release.

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

2 participants