Handle ghost methods followed by undocumented methods#1261
Handle ghost methods followed by undocumented methods#1261p8 wants to merge 2 commits intoruby:masterfrom
Conversation
`:on_nl`, `:on_ignored_nl`, `:on_comment`, `:on_embdoc` are handled by a single `when` branch. In this branch there are multiple `if` branches handling `:on_nl` and `:on_ignored_nl` separately from `:on_comment` and `:on_embdoc`. By having separate `when` branches for `:on_nl`/`:on_ignored_nl` and `:on_comment`/`:on_embdoc` we can remove the `if` statements.
Docs for ghost methods would get thrown away if the following method does not have a comment. By parsing comments on linebreaks we avoid this problem.
|
This approach changes the way to write metaprogramming comment. # This is OK
class ActiveStorage::Blob < ActiveStorage::Record
##
# :method:
#
# Returns the associated ActiveStorage::Attachment instances.
has_many :attachments, autosave: false
end
# OK in master, but document is not generated with this pull request
class ActiveStorage::Blob < ActiveStorage::Record
##
# :method:
#
# Newline between metaprogramming comment and metaprogramming code
has_many :attachments, autosave: false
endThe problem is in the RDoc notation ambiguity. ghost_method+undocumented_method and metaprogramming_comment+metaprogramming_code are ambiguous. ##
# :method: ghost
##
private # this is not a metaprogramming codeDisallow newline is one possible approach but is a big change that need to be carefully considered. |
|
Thanks for the explanation @tompng ! |
Docs for ghost methods would get thrown away if the following method
does not have a comment. By parsing comments on linebreaks we avoid this
problem.
Builds on: #1258