summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-18 02:44:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-18 02:44:50 +0000
commitfa5870b9c4f530bf2bd497ca9aacf922489ce405 (patch)
treea3f7f7c626bc117f80b6afc691ba1e62fb8c025f /lib
parentfcb112a17209e270306b52c61f960afad1fe7793 (diff)
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
Diffstat (limited to 'lib')
-rw-r--r--lib/resolv.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/resolv.rb b/lib/resolv.rb
index d38204eeca..3df88e4f9c 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -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
##