diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-01-02 14:22:59 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-01-02 14:52:27 +0900 |
commit | 314effdf77e84aac0e6ffd7bce3af41271463c22 (patch) | |
tree | 4a3a26021bfa4b48d7215571b50f006c6640fce8 | |
parent | 9135a3e864f03ba36eeb4bd2f145459dd423f712 (diff) | |
download | ruby-314effdf77e84aac0e6ffd7bce3af41271463c22.tar.gz |
[ruby/etc] [DOC] Document Etc::Passwd and Etc::Group as classes
https://github.com/ruby/etc/commit/106429f10b
-rw-r--r-- | ext/etc/etc.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/ext/etc/etc.c b/ext/etc/etc.c index 737d295abc..77c32d1ddd 100644 --- a/ext/etc/etc.c +++ b/ext/etc/etc.c @@ -1158,8 +1158,7 @@ Init_etc(void) #endif NULL); #if 0 - /* Define-const: Passwd - * + /* * Passwd is a Struct that contains the following members: * * name:: @@ -1197,12 +1196,13 @@ Init_etc(void) * expire:: * account expiration time(integer) must be compiled with +HAVE_STRUCT_PASSWD_PW_EXPIRE+ */ - rb_define_const(mEtc, "Passwd", sPasswd); + sPasswd = rb_define_class_under(mEtc, "Passwd", rb_cStruct); #endif rb_define_const(rb_cStruct, "Passwd", sPasswd); /* deprecated name */ rb_deprecate_constant(rb_cStruct, "Passwd"); rb_extend_object(sPasswd, rb_mEnumerable); rb_define_singleton_method(sPasswd, "each", etc_each_passwd, 0); + #ifdef HAVE_GETGRENT sGroup = rb_struct_define_under(mEtc, "Group", "name", #ifdef HAVE_STRUCT_GROUP_GR_PASSWD @@ -1211,8 +1211,7 @@ Init_etc(void) "gid", "mem", NULL); #if 0 - /* Define-const: Group - * + /* * Group is a Struct that is only available when compiled with +HAVE_GETGRENT+. * * The struct contains the following members: @@ -1232,7 +1231,7 @@ Init_etc(void) * is an Array of Strings containing the short login names of the * members of the group. */ - rb_define_const(mEtc, "Group", sGroup); + sGroup = rb_define_class_under(mEtc, "Group", rb_cStruct); #endif rb_define_const(rb_cStruct, "Group", sGroup); /* deprecated name */ rb_deprecate_constant(rb_cStruct, "Group"); |