[前][次][番号順一覧][スレッド一覧]

ruby-changes:73057

From: Nobuyoshi <ko1@a...>
Date: Fri, 26 Aug 2022 00:08:06 +0900 (JST)
Subject: [ruby-changes:73057] c069f50401 (master): [DOC] Tell RDoc aliases of singleton class

https://git.ruby-lang.org/ruby.git/commit/?id=c069f50401

From c069f50401583ca0d021869b104e2eb9df2cfa6a Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Thu, 25 Aug 2022 23:50:24 +0900
Subject: [DOC] Tell RDoc aliases of singleton class

Since RDoc C parser cannot capture aliases which are using an
expression other than a single variable as the class, use an
intermediate variable for the singleton class.
---
 time.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/time.c b/time.c
index 2b15239152..d2d0de91e5 100644
--- a/time.c
+++ b/time.c
@@ -5632,13 +5632,14 @@ Init_Time(void) https://github.com/ruby/ruby/blob/trunk/time.c#L5632
     rb_gc_register_mark_object(str_empty);
 
     rb_cTime = rb_define_class("Time", rb_cObject);
+    VALUE scTime = rb_singleton_class(rb_cTime);
     rb_include_module(rb_cTime, rb_mComparable);
 
     rb_define_alloc_func(rb_cTime, time_s_alloc);
     rb_define_singleton_method(rb_cTime, "utc", time_s_mkutc, -1);
     rb_define_singleton_method(rb_cTime, "local", time_s_mktime, -1);
-    rb_define_alias(rb_singleton_class(rb_cTime), "gm", "utc");
-    rb_define_alias(rb_singleton_class(rb_cTime), "mktime", "local");
+    rb_define_alias(scTime, "gm", "utc");
+    rb_define_alias(scTime, "mktime", "local");
 
     rb_define_method(rb_cTime, "to_i", time_to_i, 0);
     rb_define_method(rb_cTime, "to_f", time_to_f, 0);
@@ -5707,7 +5708,7 @@ Init_Time(void) https://github.com/ruby/ruby/blob/trunk/time.c#L5708
 
     /* methods for marshaling */
     rb_define_private_method(rb_cTime, "_dump", time_dump, -1);
-    rb_define_private_method(rb_singleton_class(rb_cTime), "_load", time_load, 1);
+    rb_define_private_method(scTime, "_load", time_load, 1);
 #if 0
     /* Time will support marshal_dump and marshal_load in the future (1.9 maybe) */
     rb_define_private_method(rb_cTime, "marshal_dump", time_mdump, 0);
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]