summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-08-25 23:50:24 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-08-26 00:07:19 +0900
commitc069f50401583ca0d021869b104e2eb9df2cfa6a (patch)
tree2618bf4109d00888bc4a4d92e1ded7ed71015814 /time.c
parentad8774f8e537a3ad73ce56bd12e75c85271f93a3 (diff)
downloadruby-c069f50401583ca0d021869b104e2eb9df2cfa6a.tar.gz
[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.
Diffstat (limited to 'time.c')
-rw-r--r--time.c7
1 files 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)
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)
/* 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);