ruby-changes:70702
From: Nobuyoshi <ko1@a...>
Date: Sun, 2 Jan 2022 15:05:50 +0900 (JST)
Subject: [ruby-changes:70702] 314effdf77 (master): [ruby/etc] [DOC] Document Etc::Passwd and Etc::Group as classes
https://git.ruby-lang.org/ruby.git/commit/?id=314effdf77 From 314effdf77e84aac0e6ffd7bce3af41271463c22 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 2 Jan 2022 14:22:59 +0900 Subject: [ruby/etc] [DOC] Document Etc::Passwd and Etc::Group as classes https://github.com/ruby/etc/commit/106429f10b --- ext/etc/etc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ext/etc/etc.c b/ext/etc/etc.c index 737d295abc6..77c32d1ddd8 100644 --- a/ext/etc/etc.c +++ b/ext/etc/etc.c @@ -1158,8 +1158,7 @@ Init_etc(void) https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.c#L1158 #endif NULL); #if 0 - /* Define-const: Passwd - * + /* * Passwd is a Struct that contains the following members: * * name:: @@ -1197,12 +1196,13 @@ Init_etc(void) https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.c#L1196 * 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) https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.c#L1211 "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) https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.c#L1231 * 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"); -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/