Skip to content

Commit

Permalink
$VERBOSE = false won't be worked since rb_warning is changed to `…
Browse files Browse the repository at this point in the history
…rb_warn`

Ref ruby/ruby#2856.
  • Loading branch information
kamipo committed Jan 28, 2020
1 parent 7a603da commit 5f9b1cd
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions lib/tzinfo/ruby_core_support.rb
Expand Up @@ -156,21 +156,15 @@ 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
# 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
o = Object.new
if [:taint, :untaint, :tainted?].none? {|m| o.respond_to?(m) } || RUBY_VERSION >= '2.7'
module UntaintExt
refine Object do
def untaint
self
end
end
end
ensure
$VERBOSE = old_verbose
end
end
end

0 comments on commit 5f9b1cd

Please sign in to comment.