1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-01-18 02:44:50 +00:00
parent fcb112a172
commit fa5870b9c4

View file

@ -236,9 +236,7 @@ class Resolv
def each_address(name, &proc)
lazy_initialize
if @name2addr.include?(name)
@name2addr[name].each(&proc)
end
@name2addr[name]&.each(&proc)
end
##