зеркало из https://github.com/github/ruby.git
[ruby/date] Fix envutil for old Ruby
https://github.com/ruby/date/commit/57e25c406a
This commit is contained in:
Родитель
313d63c2ac
Коммит
aa856d5077
|
@ -53,7 +53,7 @@ module EnvUtil
|
|||
@original_internal_encoding = Encoding.default_internal
|
||||
@original_external_encoding = Encoding.default_external
|
||||
@original_verbose = $VERBOSE
|
||||
@original_warning = %i[deprecated experimental].to_h {|i| [i, Warning[i]]} if RUBY_VERSION > "2.7"
|
||||
@original_warning = defined?(Warning.[]) ? %i[deprecated experimental].to_h {|i| [i, Warning[i]]} : nil
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -211,7 +211,7 @@ module EnvUtil
|
|||
ensure
|
||||
stderr, $stderr = $stderr, stderr
|
||||
$VERBOSE = EnvUtil.original_verbose
|
||||
EnvUtil.original_warning.each {|i, v| Warning[i] = v}
|
||||
EnvUtil.original_warning&.each {|i, v| Warning[i] = v}
|
||||
end
|
||||
module_function :verbose_warning
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче