summaryrefslogtreecommitdiff
path: root/ext/etc
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-01-02 14:22:59 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-01-02 14:52:27 +0900
commit314effdf77e84aac0e6ffd7bce3af41271463c22 (patch)
tree4a3a26021bfa4b48d7215571b50f006c6640fce8 /ext/etc
parent9135a3e864f03ba36eeb4bd2f145459dd423f712 (diff)
[ruby/etc] [DOC] Document Etc::Passwd and Etc::Group as classes
https://github.com/ruby/etc/commit/106429f10b
Diffstat (limited to 'ext/etc')
-rw-r--r--ext/etc/etc.c11
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");