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

ruby-changes:65317

From: Nobuyoshi <ko1@a...>
Date: Mon, 22 Feb 2021 13:24:44 +0900 (JST)
Subject: [ruby-changes:65317] 4e32a4ab81 (master): Search subclasses from constants

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

From 4e32a4ab81d510b1cb3cd45f7faafc917aa071cc Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 22 Feb 2021 12:01:41 +0900
Subject: Search subclasses from constants

---
 win32/mkexports.rb | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/win32/mkexports.rb b/win32/mkexports.rb
index 3c53521..70b7f3f 100755
--- a/win32/mkexports.rb
+++ b/win32/mkexports.rb
@@ -9,14 +9,11 @@ end https://github.com/ruby/ruby/blob/trunk/win32/mkexports.rb#L9
 class Exports
   PrivateNames = /(?:Init_|InitVM_|ruby_static_id_|threadptr|_ec_|DllMain\b)/
 
-  @@subclass = []
-  def self.inherited(klass)
-    @@subclass << [/#{klass.name.sub(/.*::/, '').downcase}/i, klass]
-  end
-
   def self.create(*args, &block)
     platform = RUBY_PLATFORM
-    pat, klass = @@subclass.find {|p, k| p =~ platform}
+    klass = constants.find do |p|
+      break const_get(p) if platform.include?(p.to_s.downcase)
+    end
     unless klass
       raise ArgumentError, "unsupported platform: #{platform}"
     end
-- 
cgit v1.1


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

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