Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changed IPAddress.parse() to improve speed (see new wiki benchmark page)

  • Loading branch information...
commit 10c9350c941ba49d91d01c6fe4074551d9fe4c32 1 parent 96aaf68
@bluemonk authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/ipaddress.rb
View
6 lib/ipaddress.rb
@@ -43,8 +43,12 @@ def IPAddress::parse(str)
case str
when /:.+\./
IPAddress::IPv6::Mapped.new(str)
+ when /\./
+ IPAddress::IPv4.new(str)
+ when /:/
+ IPAddress::IPv6.new(str)
else
- IPAddress::IPv4.new(str) rescue IPAddress::IPv6.new(str)
+ raise ArgumentError, "Unknown IP Address #{str}"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.