diff --git a/lib/net/imap/config/attr_type_coercion.rb b/lib/net/imap/config/attr_type_coercion.rb index 264bc63a8..f992ce9aa 100644 --- a/lib/net/imap/config/attr_type_coercion.rb +++ b/lib/net/imap/config/attr_type_coercion.rb @@ -28,7 +28,11 @@ def self.included(mod) end private_class_method :included - def self.safe(...) = Ractor.make_shareable nil.instance_eval(...).freeze + if defined?(Ractor.make_shareable) + def self.safe(...) Ractor.make_shareable nil.instance_eval(...).freeze end + else + def self.safe(...) nil.instance_eval(...).freeze end + end private_class_method :safe Types = Hash.new do |h, type| type => Proc | nil; safe{type} end