From 285c461cd2c7f7cf2afb1782cefe11462813e3af Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Sat, 30 Jan 2021 13:43:50 +0100 Subject: [PATCH] Cache dispatch cache in an instance variable --- lib/psych/visitors/visitor.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/psych/visitors/visitor.rb b/lib/psych/visitors/visitor.rb index e2585c0c..21052aa6 100644 --- a/lib/psych/visitors/visitor.rb +++ b/lib/psych/visitors/visitor.rb @@ -17,7 +17,7 @@ def self.dispatch_cache if defined?(Ractor) def dispatch - Ractor.current[:Psych_Visitors_Visitor] ||= Visitor.dispatch_cache + @dispatch_cache ||= (Ractor.current[:Psych_Visitors_Visitor] ||= Visitor.dispatch_cache) end else DISPATCH = dispatch_cache