зеркало из https://github.com/github/ruby.git
[ruby/ipaddr] Prefer String#start_with? over Regexp.match
https://github.com/ruby/ipaddr/commit/054fe12ec4
This commit is contained in:
Родитель
6ad52e336d
Коммит
73dd3ce03e
|
@ -674,7 +674,7 @@ class IPAddr
|
|||
end
|
||||
octets.inject(0) { |i, s|
|
||||
(n = s.to_i) < 256 or raise InvalidAddressError, "invalid address: #{@addr}"
|
||||
s.match(/\A0./) and raise InvalidAddressError, "zero-filled number in IPv4 address is ambiguous: #{@addr}"
|
||||
(s != '0') && s.start_with?('0') and raise InvalidAddressError, "zero-filled number in IPv4 address is ambiguous: #{@addr}"
|
||||
i << 8 | n
|
||||
}
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче