зеркало из https://github.com/github/ruby.git
[ruby/resolv] Simplify adding new entries
https://github.com/ruby/resolv/commit/081b8df705
This commit is contained in:
Родитель
30b99868f9
Коммит
012a0b9125
|
@ -196,12 +196,8 @@ class Resolv
|
|||
line.sub!(/#.*/, '')
|
||||
addr, *hostnames = line.split(/\s+/)
|
||||
next unless addr
|
||||
@addr2name[addr] = [] unless @addr2name.include? addr
|
||||
@addr2name[addr].concat(hostnames)
|
||||
hostnames.each {|hostname|
|
||||
@name2addr[hostname] = [] unless @name2addr.include? hostname
|
||||
@name2addr[hostname] << addr
|
||||
}
|
||||
(@addr2name[addr] ||= []).concat(hostnames)
|
||||
hostnames.each {|hostname| (@name2addr[hostname] ||= []) << addr}
|
||||
}
|
||||
}
|
||||
@name2addr.each {|name, arr| arr.reverse!}
|
||||
|
|
Загрузка…
Ссылка в новой задаче