diff options
author | Francis Luong (Franco) <franco@definefunk.com> | 2017-08-30 07:47:42 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-30 07:47:42 -0400 |
commit | c534ea04cb6b69d10878b3049d494f06f411fc6b (patch) | |
tree | e67494ac80b85ba94708d39426cd073bf8e5feff /lib | |
parent | 9dedeaf13caddb1827a48091c353c8f953b517ac (diff) | |
parent | c118c7174a6939cbdfd35f9aaaa39c93a30cd452 (diff) | |
download | ipaddress-c534ea04cb6b69d10878b3049d494f06f411fc6b.tar.gz |
Merge pull request #64 from ghg/return_argument_error_for_nil
Raise ArgumentError if IP address is nil
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ipaddress/ipv4.rb | 1 | ||||
-rw-r--r-- | lib/ipaddress/ipv6.rb | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/lib/ipaddress/ipv4.rb b/lib/ipaddress/ipv4.rb index 5979489..7051678 100644 --- a/lib/ipaddress/ipv4.rb +++ b/lib/ipaddress/ipv4.rb @@ -61,6 +61,7 @@ module IPAddress; # IPAddress::IPv4.new "10.0.0.1/255.0.0.0" # def initialize(str) + raise ArgumentError, "Nil IP" unless str ip, netmask = str.split("/") # Check the ip and remove white space diff --git a/lib/ipaddress/ipv6.rb b/lib/ipaddress/ipv6.rb index 2205de4..3e506ac 100644 --- a/lib/ipaddress/ipv6.rb +++ b/lib/ipaddress/ipv6.rb @@ -87,6 +87,7 @@ module IPAddress; # ip6 = IPAddress "2001:db8::8:800:200c:417a/64" # def initialize(str) + raise ArgumentError, "Nil IP" unless str ip, netmask = str.split("/") if str =~ /:.+\./ |