Is there a way to skip to the next def keyword in yard when building the source view?
Usecase
Say I'm writing a thor app. Ideally I'd document it like this:
require 'thor'
class Foo < Thor
##
# prints the current version of the gem
#
# @example
# foo version
# @return [String] current version
desc 'version', 'show the current version of the gem'
def version
puts('0.0.0')
end
end
However, then the view source option in the docs would only show the desc line
In order to get the right source output, you need to put the doc right on top of the method definition. This can be an issue as your docs increase in complexity, because it pushes your desc method call further away from the method it relates to.
require 'thor'
class Foo < Thor
desc 'version', 'show the current version of the gem'
##
# prints the current version of the gem
#
# @example
# foo version
# @return [String] current version
def version
puts('0.0.0')
end
end
Environment details
- OS: Ubuntu 16.04
- Ruby version: ruby 2.4.4p296
- YARD version: yard 0.9.16
Final notes
I can't seem to find a way to configure yard to ignore code before def, or skip lines starting with desc. The closest thing I've found is https://github.com/lsegal/yard-thor which seems mostly undocumented and unmaintained.
Is there any yard configuration or plugin that'd allow me to keep all my thor code together, and produce the right source view output?
An option to include the desc call as well as the method definition in the source output would work too.

