From f4e9658bd864c0deb2d6e4255f464d93a683ac7c Mon Sep 17 00:00:00 2001 From: Phil Ross Date: Sat, 7 Mar 2020 20:21:38 +0000 Subject: [PATCH] Test for just the non-existence of #untaint. Only Object#untaint is needed and defined by the refinement. --- lib/tzinfo.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/tzinfo.rb b/lib/tzinfo.rb index 8a80447e..6949127b 100644 --- a/lib/tzinfo.rb +++ b/lib/tzinfo.rb @@ -8,8 +8,7 @@ module TZInfo # Object#untaint is a deprecated no-op in Ruby >= 2.7 and will be removed in # 3.2. Add a refinement to either silence the warning, or supply the method if # needed. -o = Object.new -if [:taint, :untaint, :tainted?].none? {|m| o.respond_to?(m) } || RUBY_VERSION =~ /\A(\d+)\.(\d+)(?:\.|\z)/ && ($1 == '2' && $2.to_i >= 7 || $1.to_i >= 3) +if !Object.new.respond_to?(:untaint) || RUBY_VERSION =~ /\A(\d+)\.(\d+)(?:\.|\z)/ && ($1 == '2' && $2.to_i >= 7 || $1.to_i >= 3) require_relative 'tzinfo/untaint_ext' end