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:
parent
fcb112a172
commit
fa5870b9c4
1 changed files with 1 additions and 3 deletions
|
@ -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
|
||||
|
||||
##
|
||||
|
|
Loading…
Reference in a new issue