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
This commit is contained in:
normal 2016-11-21 23:50:31 +00:00
Родитель 0514a74794
Коммит 6d7dc8f7d5
1 изменённых файлов: 3 добавлений и 7 удалений

Просмотреть файл

@ -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'