Skip to content

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

@qortex

Description

@qortex

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions