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

ruby-changes:64510

From: Marc-Andre <ko1@a...>
Date: Wed, 23 Dec 2020 15:09:00 +0900 (JST)
Subject: [ruby-changes:64510] d1963adae8 (master): [ruby/psych] Avoid methods depending on bindings

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

From d1963adae8373cac771f3d62cd8d92ab11deff9e Mon Sep 17 00:00:00 2001
From: Marc-Andre Lafortune <github@m...>
Date: Sun, 20 Dec 2020 21:41:02 -0500
Subject: [ruby/psych] Avoid methods depending on bindings

Improves Ractor-readiness.

diff --git a/ext/psych/lib/psych/class_loader.rb b/ext/psych/lib/psych/class_loader.rb
index f62798c..a5d1a7a 100644
--- a/ext/psych/lib/psych/class_loader.rb
+++ b/ext/psych/lib/psych/class_loader.rb
@@ -35,9 +35,11 @@ module Psych https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych/class_loader.rb#L35
 
     constants.each do |const|
       konst = const_get const
-      define_method(const.to_s.downcase) do
-        load konst
-      end
+      class_eval <<~RUBY
+        def #{const.to_s.downcase}
+          load #{konst.inspect}
+        end
+      RUBY
     end
 
     private
-- 
cgit v0.10.2


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

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