ruby-changes:49779
From: nobu <ko1@a...>
Date: Thu, 18 Jan 2018 11:44:54 +0900 (JST)
Subject: [ruby-changes:49779] nobu:r61897 (trunk): resolv: use safe navigation operator
nobu 2018-01-18 11:44:50 +0900 (Thu, 18 Jan 2018) New Revision: 61897 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61897 Log: resolv: use safe navigation operator * lib/resolv.rb (each_address): use safe navigation operator to avoid extra hash lookups, as well as each_name since r56890. Modified files: trunk/lib/resolv.rb Index: lib/resolv.rb =================================================================== --- lib/resolv.rb (revision 61896) +++ lib/resolv.rb (revision 61897) @@ -236,9 +236,7 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb#L236 def each_address(name, &proc) lazy_initialize - if @name2addr.include?(name) - @name2addr[name].each(&proc) - end + @name2addr[name]&.each(&proc) end ## -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/