From d1963adae8373cac771f3d62cd8d92ab11deff9e Mon Sep 17 00:00:00 2001 From: Marc-Andre Lafortune Date: Sun, 20 Dec 2020 21:41:02 -0500 Subject: [ruby/psych] Avoid methods depending on bindings Improves Ractor-readiness. --- ext/psych/lib/psych/class_loader.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ext/psych') diff --git a/ext/psych/lib/psych/class_loader.rb b/ext/psych/lib/psych/class_loader.rb index f62798c36d..a5d1a7a4a9 100644 --- a/ext/psych/lib/psych/class_loader.rb +++ b/ext/psych/lib/psych/class_loader.rb @@ -35,9 +35,11 @@ module Psych 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 v1.2.3