当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Ruby C.find_class_comment用法及代码示例


本文简要介绍ruby语言中 RDoc::Parser::C.find_class_comment 的用法。

用法

find_class_comment(class_name, class_mod)

在 Init_ class_name (void)、Document-class class_name(或模块)注释或 rb_define_class(或模块)上方查找类或模块文档。如果在匹配的 Init_ 和 rb_define_class 上方提供了注释,则使用 Init_ 注释。

/*
 * This is a comment for Foo
 */
Init_Foo(void) {
    VALUE cFoo = rb_define_class("Foo", rb_cObject);
}

/*
 * Document-class: Foo
 * This is a comment for Foo
 */
Init_foo(void) {
    VALUE cFoo = rb_define_class("Foo", rb_cObject);
}

/*
 * This is a comment for Foo
 */
VALUE cFoo = rb_define_class("Foo", rb_cObject);

相关用法


注:本文由纯净天空筛选整理自ruby-lang.org大神的英文原创作品 C.find_class_comment。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。