Skip to content

Commit ae08ae2

Browse files
nobuhsbt
authored andcommitted
[DOC] Added notes regarding :nodoc: in C code
1 parent 6231b03 commit ae08ae2

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

doc/rdoc/markup_reference.rb

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,32 @@
467467
#
468468
# - Appended to a line of code
469469
# that defines a class, module, method, alias, constant, or attribute.
470+
#
470471
# - Specifies that the defined object should not be documented.
471472
#
473+
# - For method definitions in C code, it must be placed before the
474+
# implementation:
475+
#
476+
# /* :nodoc: */
477+
# static VALUE
478+
# some_method(VALUE self)
479+
# {
480+
# return self;
481+
# }
482+
#
483+
# Note that this directive has <em>no effect at all</em> at method
484+
# definition places. E.g.,
485+
#
486+
# /* :nodoc: */
487+
# rb_define_method(cMyClass, "do_something", something_func, 0);
488+
#
489+
# The above comment is just a comment and has nothing to do with \RDoc.
490+
# Therefore, +do_something+ method will be reported as "undocumented"
491+
# unless that method or function is documented elsewhere.
492+
#
493+
# - For constant definitions in C code, this directive <em>can not work</em>
494+
# because there is no "implementation" place for constants.
495+
#
472496
# - <tt># :nodoc: all</tt>:
473497
#
474498
# - Appended to a line of code
@@ -502,8 +526,8 @@
502526
# #++
503527
# # Documented.
504528
#
505-
# For C code, any of directives <tt>:startdoc:</tt>, <tt>:enddoc:</tt>,
506-
# and <tt>:nodoc:</tt> may appear in a stand-alone comment:
529+
# For C code, any of directives <tt>:startdoc:</tt>, <tt>:stopdoc:</tt>,
530+
# and <tt>:enddoc:</tt> may appear in a stand-alone comment:
507531
#
508532
# /* :startdoc: */
509533
# /* :stopdoc: */
@@ -1192,13 +1216,26 @@
11921216
#
11931217
class RDoc::MarkupReference
11941218

1219+
# exmaple class
11951220
class DummyClass; end
1221+
1222+
# exmaple module
11961223
module DummyModule; end
1224+
1225+
# exmaple singleton method
11971226
def self.dummy_singleton_method(foo, bar); end
1227+
1228+
# example instance method
11981229
def dummy_instance_method(foo, bar); end;
1230+
11991231
alias dummy_instance_alias dummy_instance_method
1232+
1233+
# exmaple attribute
12001234
attr_accessor :dummy_attribute
1235+
12011236
alias dummy_attribute_alias dummy_attribute
1237+
1238+
# exmaple constant
12021239
DUMMY_CONSTANT = ''
12031240

12041241
# :call-seq:

0 commit comments

Comments
 (0)