summaryrefslogtreecommitdiff
path: root/lib/resolv.rb
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-21 23:50:31 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-21 23:50:31 +0000
commit6d7dc8f7d5e57431bebb9252e2ddf89417bf283f (patch)
treeb83136764d67226db03c364378df3e67df27c950 /lib/resolv.rb
parent0514a747941e8e03fcfb154ad32bf880ea95011a (diff)
resolv: use symbol proc when possible
This reduces both human code and bytecode. lib/resolv.rb (sender_for, Config.parse_resolv_conf): use symbol proc git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/resolv.rb')
-rw-r--r--lib/resolv.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/resolv.rb b/lib/resolv.rb
index bff673c990..6e7fb98733 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -25,7 +25,7 @@ end
#
# Resolv::DNS.open do |dns|
# ress = dns.getresources "www.ruby-lang.org", Resolv::DNS::Resource::IN::A
-# p ress.map { |r| r.address }
+# p ress.map(&:address)
# ress = dns.getresources "ruby-lang.org", Resolv::DNS::Resource::IN::MX
# p ress.map { |r| [r.exchange.to_s, r.preference] }
# end
@@ -722,9 +722,7 @@ class Resolv
def close
socks = @socks
@socks = nil
- if socks
- socks.each {|sock| sock.close }
- end
+ socks.each(&:close) if socks
end
class Sender # :nodoc:
@@ -937,9 +935,7 @@ class Resolv
f.each {|line|
line.sub!(/[#;].*/, '')
keyword, *args = line.split(/\s+/)
- args.each { |arg|
- arg.untaint
- }
+ args.each(&:untaint)
next unless keyword
case keyword
when 'nameserver'