Look for class or module documentation above Init_+class_name+(void), in a
Document-classclass_name
(or module) comment or above an rb_define_class (or module). If a comment
is supplied above a matching Init_ and a rb_define_class the Init_ comment
is used.
/*
* This is a comment for Foo
*/Init_Foo(void){VALUEcFoo=rb_define_class("Foo",rb_cObject);}/*
* Document-class: Foo
* This is a comment for Foo
*/Init_foo(void){VALUEcFoo=rb_define_class("Foo",rb_cObject);}/*
* This is a comment for Foo
*/VALUEcFoo=rb_define_class("Foo",rb_cObject);
# File lib/rdoc/parser/c.rb, line 735
def find_class_comment class_name, class_mod
comment = nil
if @content =~ %
((?>/\*.*?\*/\s+))
(static\s+)?
void\s+
Init_#{class_name}\s*(?:_\(\s*)?\(\s*(?:void\s*)?\)%mi then
comment = $1.sub(%Document-(?:class|module):\s+#{class_name}%, '')
elsif @content =~ %Document-(?:class|module):\s+#{class_name}\s*?
(?:<\s+[:,\w]+)?\n((?>.*?\*/))%m then
comment = "/*\n#{$1}"
elsif @content =~ %.*((?>/\*.*?\*/\s+))
([\w\.\s]+\s* = \s+)?rb_define_(class|module).*?"(#{class_name})"%m then
comment = $1
elsif @content =~ %.*((?>/\*.*?\*/\s+))
([\w\.\s]+\s* = \s+)?rb_define_(class|module)_under.*?"(#{class_name.split('::').last})"%m then
comment = $1
else
comment = ''
end
comment = RDoc::Comment.new comment, @top_level
comment.normalize
look_for_directives_in class_mod, comment
class_mod.add_comment comment, @top_level
end