summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorbluemonk <ceresa@gmail.com>2010-09-07 18:08:02 +0200
committerbluemonk <ceresa@gmail.com>2010-09-07 18:08:02 +0200
commitf9747c75e0038cdfe1ac8c1605d9f1c63f0369d5 (patch)
tree8f17439dd62c5b5618993713292389bdcbf19e28 /lib
parent08b1cef4690f11e6217c301356e07d4aeabac833 (diff)
downloadipaddress-f9747c75e0038cdfe1ac8c1605d9f1c63f0369d5.tar.gz
Formatted README, rewrote IPAddress::parse and wrote IPv4#parse_classful testperform
Diffstat (limited to 'lib')
-rw-r--r--lib/ipaddress.rb6
-rw-r--r--lib/ipaddress/extensions/extensions.rb6
2 files changed, 4 insertions, 8 deletions
diff --git a/lib/ipaddress.rb b/lib/ipaddress.rb
index d7397f6..0c8b331 100644
--- a/lib/ipaddress.rb
+++ b/lib/ipaddress.rb
@@ -46,11 +46,7 @@ module IPAddress
when /:.+\./
IPAddress::IPv6::Mapped.new(str)
else
- begin
- IPAddress::IPv4.new(str)
- rescue ArgumentError
- IPAddress::IPv6.new(str)
- end
+ IPAddress::IPv4.new(str) rescue IPAddress::IPv6.new(str)
end
end
diff --git a/lib/ipaddress/extensions/extensions.rb b/lib/ipaddress/extensions/extensions.rb
index a474e18..4e0bc88 100644
--- a/lib/ipaddress/extensions/extensions.rb
+++ b/lib/ipaddress/extensions/extensions.rb
@@ -1,14 +1,14 @@
-class << Math
+class << Math # :nodoc:
def log2(n); log(n) / log(2); end
end
if RUBY_VERSION =~ /1\.8/
- class Hash
+ class Hash # :nodoc:
alias :key :index
end
end
-class Integer
+class Integer # :nodoc:
def power_of_2?
Math::log2(self).to_i == Math::log2(self)
end