summaryrefslogtreecommitdiff
path: root/ext/psych
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2020-12-20 21:41:02 -0500
committerMarc-André Lafortune <github@marc-andre.ca>2020-12-23 01:08:38 -0500
commitd1963adae8373cac771f3d62cd8d92ab11deff9e (patch)
treec6d02e10895e057f0efb5fb706839ccd5d480028 /ext/psych
parent0eb94dae4aec58de06051cf89d555994838452f2 (diff)
[ruby/psych] Avoid methods depending on bindings
Improves Ractor-readiness.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3953
Diffstat (limited to 'ext/psych')
-rw-r--r--ext/psych/lib/psych/class_loader.rb8
1 files changed, 5 insertions, 3 deletions
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
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