yard icon indicating copy to clipboard operation
yard copied to clipboard

@!parse directive is ignored when it precedes an include

Open wioux opened this issue 3 years ago • 0 comments

The release notes for the parse directive indicate that it can be used directly above a module include.

I've been trying to get this to work, but the docstring seems to be ignored in this context. I traced the issue to YARD::Handlers::Ruby::DSLHandlerMethods, which skips docstring handling when the "dsl" method is include.

Steps to reproduce

  1. Create a file test.rb matching the use case mentioned in the release notes:
module TheDynamicModule
  def foobar; end
end

class MyClass
  # @!parse extend TheDynamicModule
  include TheDynamicModule
end
  1. Document with --embed-mixins turned on:
$ yard doc --embed-mixins test.rb
  1. Open doc/MyClass.html to review

Actual Output

#foobar is listed as an instance method of MyClass:

Screenshot_2021-04-15_13-59-43

Expected Output

#foobar should be listed as a class method of MyClass. I can achieve this by putting the parse directive before a method declaration instead, but I expected it to work before include as well.

  # @!parse extend TheDynamicModule
  def noop; end
  include TheDynamicModule

Screenshot_2021-04-15_14-01-46

Environment details:

  • OS: Ubuntu 18.04.5 LTS
  • Ruby version (ruby -v): ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
  • YARD version (yard -v): yard 0.9.26

I have read the Contributing Guide.

wioux avatar Apr 15 '21 21:04 wioux