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

ruby-changes:71418

From: Nobuyoshi <ko1@a...>
Date: Tue, 15 Mar 2022 08:21:07 +0900 (JST)
Subject: [ruby-changes:71418] aa347cbe65 (master): [ruby/win32ole] Rename toplevel WIN32OLE_* classes

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

From aa347cbe65031ff02a5b2de0f7a36e29d72b8008 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 14 Mar 2022 19:07:02 +0900
Subject: [ruby/win32ole] Rename toplevel WIN32OLE_* classes

https://github.com/ruby/win32ole/commit/bc7deb6a6a
---
 ext/win32ole/win32ole_event.c    | 3 ++-
 ext/win32ole/win32ole_method.c   | 3 ++-
 ext/win32ole/win32ole_param.c    | 3 ++-
 ext/win32ole/win32ole_record.c   | 3 ++-
 ext/win32ole/win32ole_type.c     | 3 ++-
 ext/win32ole/win32ole_typelib.c  | 3 ++-
 ext/win32ole/win32ole_variable.c | 3 ++-
 ext/win32ole/win32ole_variant.c  | 3 ++-
 8 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/ext/win32ole/win32ole_event.c b/ext/win32ole/win32ole_event.c
index 041639af6c..93e4d6bad5 100644
--- a/ext/win32ole/win32ole_event.c
+++ b/ext/win32ole/win32ole_event.c
@@ -1264,7 +1264,8 @@ Init_win32ole_event(void) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_event.c#L1264
     ary_ole_event = rb_ary_new();
     rb_gc_register_mark_object(ary_ole_event);
     id_events = rb_intern("events");
-    cWIN32OLE_EVENT = rb_define_class("WIN32OLE_EVENT", rb_cObject);
+    cWIN32OLE_EVENT = rb_define_class_under(cWIN32OLE, "Event", rb_cObject);
+    rb_define_const(rb_cObject, "WIN32OLE_EVENT", cWIN32OLE_EVENT);
     rb_define_singleton_method(cWIN32OLE_EVENT, "message_loop", fev_s_msg_loop, 0);
     rb_define_alloc_func(cWIN32OLE_EVENT, fev_s_allocate);
     rb_define_method(cWIN32OLE_EVENT, "initialize", fev_initialize, -1);
diff --git a/ext/win32ole/win32ole_method.c b/ext/win32ole/win32ole_method.c
index 6ed5def6d7..646fdaf60c 100644
--- a/ext/win32ole/win32ole_method.c
+++ b/ext/win32ole/win32ole_method.c
@@ -927,7 +927,8 @@ VALUE cWIN32OLE_METHOD; https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_method.c#L927
 
 void Init_win32ole_method(void)
 {
-    cWIN32OLE_METHOD = rb_define_class("WIN32OLE_METHOD", rb_cObject);
+    cWIN32OLE_METHOD = rb_define_class_under(cWIN32OLE, "Method", rb_cObject);
+    rb_define_const(rb_cObject, "WIN32OLE_METHOD", cWIN32OLE_METHOD);
     rb_define_alloc_func(cWIN32OLE_METHOD, folemethod_s_allocate);
     rb_define_method(cWIN32OLE_METHOD, "initialize", folemethod_initialize, 2);
     rb_define_method(cWIN32OLE_METHOD, "name", folemethod_name, 0);
diff --git a/ext/win32ole/win32ole_param.c b/ext/win32ole/win32ole_param.c
index 52905b3e8e..b654aaa845 100644
--- a/ext/win32ole/win32ole_param.c
+++ b/ext/win32ole/win32ole_param.c
@@ -422,7 +422,8 @@ foleparam_inspect(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_param.c#L422
 void
 Init_win32ole_param(void)
 {
-    cWIN32OLE_PARAM = rb_define_class("WIN32OLE_PARAM", rb_cObject);
+    cWIN32OLE_PARAM = rb_define_class_under(cWIN32OLE, "Param", rb_cObject);
+    rb_define_const(rb_cObject, "WIN32OLE_PARAM", cWIN32OLE_PARAM);
     rb_define_alloc_func(cWIN32OLE_PARAM, foleparam_s_allocate);
     rb_define_method(cWIN32OLE_PARAM, "initialize", foleparam_initialize, 2);
     rb_define_method(cWIN32OLE_PARAM, "name", foleparam_name, 0);
diff --git a/ext/win32ole/win32ole_record.c b/ext/win32ole/win32ole_record.c
index 03523bc47d..9e18653db9 100644
--- a/ext/win32ole/win32ole_record.c
+++ b/ext/win32ole/win32ole_record.c
@@ -594,7 +594,8 @@ VALUE cWIN32OLE_RECORD; https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_record.c#L594
 void
 Init_win32ole_record(void)
 {
-    cWIN32OLE_RECORD = rb_define_class("WIN32OLE_RECORD", rb_cObject);
+    cWIN32OLE_RECORD = rb_define_class_under(cWIN32OLE, "Record", rb_cObject);
+    rb_define_const(rb_cObject, "WIN32OLE_RECORD", cWIN32OLE_RECORD);
     rb_define_alloc_func(cWIN32OLE_RECORD, folerecord_s_allocate);
     rb_define_method(cWIN32OLE_RECORD, "initialize", folerecord_initialize, 2);
     rb_define_method(cWIN32OLE_RECORD, "to_h", folerecord_to_h, 0);
diff --git a/ext/win32ole/win32ole_type.c b/ext/win32ole/win32ole_type.c
index 48dbc9dbde..1b96aea858 100644
--- a/ext/win32ole/win32ole_type.c
+++ b/ext/win32ole/win32ole_type.c
@@ -887,7 +887,8 @@ VALUE cWIN32OLE_TYPE; https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L887
 
 void Init_win32ole_type(void)
 {
-    cWIN32OLE_TYPE = rb_define_class("WIN32OLE_TYPE", rb_cObject);
+    cWIN32OLE_TYPE = rb_define_class_under(cWIN32OLE, "Type", rb_cObject);
+    rb_define_const(rb_cObject, "WIN32OLE_TYPE", cWIN32OLE_TYPE);
     rb_define_singleton_method(cWIN32OLE_TYPE, "ole_classes", foletype_s_ole_classes, 1);
     rb_define_singleton_method(cWIN32OLE_TYPE, "typelibs", foletype_s_typelibs, 0);
     rb_define_singleton_method(cWIN32OLE_TYPE, "progids", foletype_s_progids, 0);
diff --git a/ext/win32ole/win32ole_typelib.c b/ext/win32ole/win32ole_typelib.c
index d89f181e07..651dc2d75f 100644
--- a/ext/win32ole/win32ole_typelib.c
+++ b/ext/win32ole/win32ole_typelib.c
@@ -827,7 +827,8 @@ VALUE cWIN32OLE_TYPELIB; https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_typelib.c#L827
 void
 Init_win32ole_typelib(void)
 {
-    cWIN32OLE_TYPELIB = rb_define_class("WIN32OLE_TYPELIB", rb_cObject);
+    cWIN32OLE_TYPELIB = rb_define_class_under(cWIN32OLE, "Typelib", rb_cObject);
+    rb_define_const(rb_cObject, "WIN32OLE_TYPELIB", cWIN32OLE_TYPELIB);
     rb_define_singleton_method(cWIN32OLE_TYPELIB, "typelibs", foletypelib_s_typelibs, 0);
     rb_define_alloc_func(cWIN32OLE_TYPELIB, foletypelib_s_allocate);
     rb_define_method(cWIN32OLE_TYPELIB, "initialize", foletypelib_initialize, -2);
diff --git a/ext/win32ole/win32ole_variable.c b/ext/win32ole/win32ole_variable.c
index 8d80455d97..e7f58c891e 100644
--- a/ext/win32ole/win32ole_variable.c
+++ b/ext/win32ole/win32ole_variable.c
@@ -369,7 +369,8 @@ VALUE cWIN32OLE_VARIABLE; https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_variable.c#L369
 
 void Init_win32ole_variable(void)
 {
-    cWIN32OLE_VARIABLE = rb_define_class("WIN32OLE_VARIABLE", rb_cObject);
+    cWIN32OLE_VARIABLE = rb_define_class_under(cWIN32OLE, "Variable", rb_cObject);
+    rb_define_const(rb_cObject, "WIN32OLE_VARIABLE", cWIN32OLE_VARIABLE);
     rb_undef_alloc_func(cWIN32OLE_VARIABLE);
     rb_define_method(cWIN32OLE_VARIABLE, "name", folevariable_name, 0);
     rb_define_method(cWIN32OLE_VARIABLE, "ole_type", folevariable_ole_type, 0);
diff --git a/ext/win32ole/win32ole_variant.c b/ext/win32ole/win32ole_variant.c
index 0953fc324c..f1d83ed2e1 100644
--- a/ext/win32ole/win32ole_variant.c
+++ b/ext/win32ole/win32ole_variant.c
@@ -695,7 +695,8 @@ void https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_variant.c#L695
 Init_win32ole_variant(void)
 {
 #undef rb_intern
-    cWIN32OLE_VARIANT = rb_define_class("WIN32OLE_VARIANT", rb_cObject);
+    cWIN32OLE_VARIANT = rb_define_class_under(cWIN32OLE, "Variant", rb_cObject);
+    rb_define_const(rb_cObject, "WIN32OLE_VARIANT", cWIN32OLE_VARIANT);
     rb_define_alloc_func(cWIN32OLE_VARIANT, folevariant_s_allocate);
     rb_define_singleton_method(cWIN32OLE_VARIANT, "array", folevariant_s_array, 2);
     rb_define_method(cWIN32OLE_VARIANT, "initialize", folevariant_initialize, -2);
-- 
cgit v1.2.1


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

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