當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。