[前][次][番号順一覧][スレッド一覧]

ruby-changes:64517

From: Kenta <ko1@a...>
Date: Wed, 23 Dec 2020 18:33:43 +0900 (JST)
Subject: [ruby-changes:64517] aa856d5077 (master): [ruby/date] Fix envutil for old Ruby

https://git.ruby-lang.org/ruby.git/commit/?id=aa856d5077

From aa856d50772aaaceb7b245b8b59f1ab1851a7fab Mon Sep 17 00:00:00 2001
From: Kenta Murata <mrkn@m...>
Date: Wed, 23 Dec 2020 16:54:54 +0900
Subject: [ruby/date] Fix envutil for old Ruby

https://github.com/ruby/date/commit/57e25c406a

diff --git a/tool/lib/envutil.rb b/tool/lib/envutil.rb
index 63e23ba..937e112 100644
--- a/tool/lib/envutil.rb
+++ b/tool/lib/envutil.rb
@@ -53,7 +53,7 @@ module EnvUtil https://github.com/ruby/ruby/blob/trunk/tool/lib/envutil.rb#L53
       @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 https://github.com/ruby/ruby/blob/trunk/tool/lib/envutil.rb#L211
   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
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]