-
Notifications
You must be signed in to change notification settings - Fork 448
Description
Usage of these :nodoc: are not correct but frequently misused. Maybe it's better to apply :nodoc: to the CodeObject next line.
class Foo
# :nodoc: (This :nodoc: is applied to class Foo, not to method bar)
def bar; end
# :nodoc: (Same as above)
def baz; end
endCorrect usage is:
class Foo
# :nodoc: (for class Foo)
def bar
end
def baz # :nodoc: (for method baz)
end
endThis behavior looks like a bug.
class Foo
# This is a comment for method bar
# :nodoc: (this is a nodoc directive for class Foo)
# :call-seq: bar(x, y) (this is a call-seq directive for method bar)
# This is also a coment for method bar
def bar
end
endSuggestion
If comment only contains container directive(including :nodoc:) and it appears at first line in class/module, it is a directive for container itself.
class Foo
# :nodoc: (for container)
# :stopdoc: (for container)
def foo; end
endIf a comment before code object contains container directive(except :nodoc:), it's for container
class Foo
...
# :stopdoc: (for container)
def foo; end
endOther comments are for code object. If it contains container directive(except :nodoc:), it's an error to be warned.
class Foo
# :nodoc: (for method)
# comment
def foo; end
# :nodoc: (for method)
def foo; end
endDirective categories
Directive categorization will be a bit complicated, but I think it's worth clarifying it.
Container directive
Must not mix with code object directives, comment containing these directives must not associated with code object.
:startdoc: :stopdoc: :enddoc: :doc: :category:
Container special directive
Must not mix with code object directives. Comment text is specially handled.
:section:
Situation dependent directive
Can be both container directive or code object directive
:nodoc:
CodeObject directive
Other directives. :callseq: :yield: and also unknown ones.