зеркало из https://github.com/github/ruby.git
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:
Родитель
0514a74794
Коммит
6d7dc8f7d5
|
@ -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'
|
||||
|
|
Загрузка…
Ссылка в новой задаче