Skip to content

Commit

Permalink
Test for just the non-existence of #untaint.
Browse files Browse the repository at this point in the history
Only Object#untaint is needed and defined by the refinement.
  • Loading branch information
philr committed Mar 7, 2020
1 parent b6b0f77 commit f4e9658
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/tzinfo.rb
Expand Up @@ -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

Expand Down

0 comments on commit f4e9658

Please sign in to comment.