When I try to write a document for the code in ActiveSupport::Concern#included
on a Rails project, the YARD side does not recognize the comment and cannot generate the document.
For example, the code is as follows:
module Product::Scopes
extend ActiveSupport::Concern
included do
# @!methododd
# return an odd number of id items
# @!scope class
scope: odd, ->{where('products.id%2=1')}
end
end
If you run YARD with the above code, the #odd
will not be recognized at all and a blank page will appear.
I tried many things, but I couldn't find a good way to avoid it.#Included If you write outside, you can do something about it, but then the meaning of writing a document in the source code will be eliminated.
Please let me know if there are any good workarounds.Thank you for your cooperation.
ruby-on-rails ruby
I'm sorry if I am not allowed to post here as I don't speak Japanese, but this question is one of the first results to the search "ruby year activities support concern".As I need a solution for the same problem as @Hazi, I configured it would make sense before the peace.
https://github.com/digitalcuisine/yard-activesupport-concern
This YARD plugin adds support for ActiveSupport::Concern modules by installing YARD to parse blocks give to included
and class_methods
calls.
© 2024 OneMinuteCode. All rights reserved.