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

ruby-changes:47340

From: kazu <ko1@a...>
Date: Tue, 1 Aug 2017 09:19:15 +0900 (JST)
Subject: [ruby-changes:47340] kazu:r59455 (trunk): Use `&.` instead of modifier if

kazu	2017-08-01 09:19:10 +0900 (Tue, 01 Aug 2017)

  New Revision: 59455

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59455

  Log:
    Use `&.` instead of modifier if

  Modified files:
    trunk/test/net/http/test_http.rb
Index: test/net/http/test_http.rb
===================================================================
--- test/net/http/test_http.rb	(revision 59454)
+++ test/net/http/test_http.rb	(revision 59455)
@@ -237,7 +237,7 @@ module TestNetHTTP_version_1_1_methods https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http.rb#L237
     begin
       h = Net::HTTP.start(config('host'), config('port'))
     ensure
-      h.finish if h
+      h&.finish
     end
     assert_equal config('host'), h.address
     assert_equal config('port'), h.port
@@ -246,7 +246,7 @@ module TestNetHTTP_version_1_1_methods https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http.rb#L246
     begin
       h = Net::HTTP.start(config('host'), config('port'), :ENV)
     ensure
-      h.finish if h
+      h&.finish
     end
     assert_equal config('host'), h.address
     assert_equal config('port'), h.port
@@ -255,7 +255,7 @@ module TestNetHTTP_version_1_1_methods https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http.rb#L255
     begin
       h = Net::HTTP.start(config('host'), config('port'), nil)
     ensure
-      h.finish if h
+      h&.finish
     end
     assert_equal config('host'), h.address
     assert_equal config('port'), h.port

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

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