Skip to content

Commit

Permalink
Merge pull request #112.
Browse files Browse the repository at this point in the history
  • Loading branch information
philr committed Mar 7, 2020
2 parents e0e66f8 + 62d902f commit d8556f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
19 changes: 6 additions & 13 deletions lib/tzinfo/ruby_core_support.rb
Expand Up @@ -154,23 +154,16 @@ def self.open_file(file_name, mode, opts, &block)


# Object#untaint is a deprecated no-op in Ruby >= 2.7 and will be removed in
# 3.0. Add a refinement to either silence the warning, or supply the method
# 3.2. Add a refinement to either silence the warning, or supply the method
# if needed.
old_verbose = $VERBOSE
$VERBOSE = false
begin
o = Object.new
if [:taint, :untaint, :tainted?].none? {|m| o.respond_to?(m) } || !o.taint.tainted?
module UntaintExt
refine Object do
def untaint
self
end
if !Object.new.respond_to?(:untaint) || RUBY_VERSION =~ /\A(\d+)\.(\d+)(?:\.|\z)/ && ($1 == '2' && $2.to_i >= 7 || $1.to_i >= 3)
module UntaintExt
refine Object do
def untaint
self
end
end
end
ensure
$VERBOSE = old_verbose
end
end
end
2 changes: 1 addition & 1 deletion test/test_utils.rb
Expand Up @@ -169,7 +169,7 @@ def assert_nothing_raised(msg = nil)


# Object#taint is a deprecated no-op in Ruby 2.7 and outputs a warning. It will
# be removed in 3.0. Silence the warning or supply a replacement.
# be removed in 3.2. Silence the warning or supply a replacement.
if TZInfo::RubyCoreSupport.const_defined?(:UntaintExt)
module TaintExt
refine Object do
Expand Down

0 comments on commit d8556f0

Please sign in to comment.