Skip to content

Commit 106429f

Browse files
committed
[DOC] Document Etc::Passwd and Etc::Group as classes
1 parent 8c8c619 commit 106429f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

ext/etc/etc.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,8 +1158,7 @@ Init_etc(void)
11581158
#endif
11591159
NULL);
11601160
#if 0
1161-
/* Define-const: Passwd
1162-
*
1161+
/*
11631162
* Passwd is a Struct that contains the following members:
11641163
*
11651164
* name::
@@ -1197,12 +1196,13 @@ Init_etc(void)
11971196
* expire::
11981197
* account expiration time(integer) must be compiled with +HAVE_STRUCT_PASSWD_PW_EXPIRE+
11991198
*/
1200-
rb_define_const(mEtc, "Passwd", sPasswd);
1199+
sPasswd = rb_define_class_under(mEtc, "Passwd", rb_cStruct);
12011200
#endif
12021201
rb_define_const(rb_cStruct, "Passwd", sPasswd); /* deprecated name */
12031202
rb_deprecate_constant(rb_cStruct, "Passwd");
12041203
rb_extend_object(sPasswd, rb_mEnumerable);
12051204
rb_define_singleton_method(sPasswd, "each", etc_each_passwd, 0);
1205+
12061206
#ifdef HAVE_GETGRENT
12071207
sGroup = rb_struct_define_under(mEtc, "Group", "name",
12081208
#ifdef HAVE_STRUCT_GROUP_GR_PASSWD
@@ -1211,8 +1211,7 @@ Init_etc(void)
12111211
"gid", "mem", NULL);
12121212

12131213
#if 0
1214-
/* Define-const: Group
1215-
*
1214+
/*
12161215
* Group is a Struct that is only available when compiled with +HAVE_GETGRENT+.
12171216
*
12181217
* The struct contains the following members:
@@ -1232,7 +1231,7 @@ Init_etc(void)
12321231
* is an Array of Strings containing the short login names of the
12331232
* members of the group.
12341233
*/
1235-
rb_define_const(mEtc, "Group", sGroup);
1234+
sGroup = rb_define_class_under(mEtc, "Group", rb_cStruct);
12361235
#endif
12371236
rb_define_const(rb_cStruct, "Group", sGroup); /* deprecated name */
12381237
rb_deprecate_constant(rb_cStruct, "Group");

0 commit comments

Comments
 (0)