ipaddress 0.7.5 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +13 -0
- data/README.rdoc +106 -80
- data/VERSION +1 -1
- data/ipaddress.gemspec +55 -0
- data/lib/ipaddress.rb +16 -2
- data/lib/ipaddress/ipv4.rb +76 -68
- data/lib/ipaddress/ipv6.rb +132 -22
- data/lib/ipaddress/prefix.rb +14 -1
- data/test/ipaddress/ipv4_test.rb +65 -43
- data/test/ipaddress/ipv6_test.rb +68 -2
- metadata +26 -48
- data/lib/ipaddress/extensions/extensions.rb +0 -22
- data/test/ipaddress/extensions/extensions_test.rb +0 -18
metadata
CHANGED
@@ -1,46 +1,39 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ipaddress
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 7
|
9
|
-
- 5
|
10
|
-
version: 0.7.5
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.8.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Marco Ceresa
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-04-08 00:00:00 +02:00
|
12
|
+
date: 2011-05-17 00:00:00.000000000 +02:00
|
19
13
|
default_executable:
|
20
14
|
dependencies: []
|
21
|
-
|
22
|
-
|
15
|
+
description: ! " IPAddress is a Ruby library designed to make manipulation \n
|
16
|
+
\ of IPv4 and IPv6 addresses both powerful and simple. It mantains\n a
|
17
|
+
layer of compatibility with Ruby's own IPAddr, while \n addressing many of
|
18
|
+
its issues.\n"
|
23
19
|
email: ceresa@gmail.com
|
24
20
|
executables: []
|
25
|
-
|
26
21
|
extensions: []
|
27
|
-
|
28
|
-
extra_rdoc_files:
|
22
|
+
extra_rdoc_files:
|
29
23
|
- LICENSE
|
30
24
|
- README.rdoc
|
31
|
-
files:
|
25
|
+
files:
|
32
26
|
- .document
|
33
27
|
- CHANGELOG.rdoc
|
34
28
|
- LICENSE
|
35
29
|
- README.rdoc
|
36
30
|
- Rakefile
|
37
31
|
- VERSION
|
32
|
+
- ipaddress.gemspec
|
38
33
|
- lib/ipaddress.rb
|
39
|
-
- lib/ipaddress/extensions/extensions.rb
|
40
34
|
- lib/ipaddress/ipv4.rb
|
41
35
|
- lib/ipaddress/ipv6.rb
|
42
36
|
- lib/ipaddress/prefix.rb
|
43
|
-
- test/ipaddress/extensions/extensions_test.rb
|
44
37
|
- test/ipaddress/ipv4_test.rb
|
45
38
|
- test/ipaddress/ipv6_test.rb
|
46
39
|
- test/ipaddress/prefix_test.rb
|
@@ -49,41 +42,26 @@ files:
|
|
49
42
|
has_rdoc: true
|
50
43
|
homepage: http://github.com/bluemonk/ipaddress
|
51
44
|
licenses: []
|
52
|
-
|
53
45
|
post_install_message:
|
54
46
|
rdoc_options: []
|
55
|
-
|
56
|
-
require_paths:
|
47
|
+
require_paths:
|
57
48
|
- lib
|
58
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
50
|
none: false
|
60
|
-
requirements:
|
61
|
-
- -
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
|
64
|
-
|
65
|
-
- 0
|
66
|
-
version: "0"
|
67
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
56
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
segments:
|
74
|
-
- 0
|
75
|
-
version: "0"
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
76
61
|
requirements: []
|
77
|
-
|
78
62
|
rubyforge_project:
|
79
|
-
rubygems_version: 1.
|
63
|
+
rubygems_version: 1.6.2
|
80
64
|
signing_key:
|
81
65
|
specification_version: 3
|
82
66
|
summary: IPv4/IPv6 addresses manipulation library
|
83
|
-
test_files:
|
84
|
-
- test/ipaddress/extensions/extensions_test.rb
|
85
|
-
- test/ipaddress/ipv4_test.rb
|
86
|
-
- test/ipaddress/ipv6_test.rb
|
87
|
-
- test/ipaddress/prefix_test.rb
|
88
|
-
- test/ipaddress_test.rb
|
89
|
-
- test/test_helper.rb
|
67
|
+
test_files: []
|
@@ -1,22 +0,0 @@
|
|
1
|
-
class << Math # :nodoc:
|
2
|
-
def log2(n); log(n) / log(2); end
|
3
|
-
end
|
4
|
-
|
5
|
-
if RUBY_VERSION =~ /1\.8/
|
6
|
-
class Hash # :nodoc:
|
7
|
-
alias :key :index
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
class Integer # :nodoc:
|
12
|
-
def power_of_2?
|
13
|
-
Math::log2(self).to_i == Math::log2(self)
|
14
|
-
end
|
15
|
-
|
16
|
-
def closest_power_of_2(limit=32)
|
17
|
-
self.upto(limit) do |i|
|
18
|
-
return i if i.power_of_2?
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class ExtensionsTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
def test_method_power_of_2?
|
6
|
-
assert_equal true, 16.power_of_2?
|
7
|
-
assert_equal false, 20.power_of_2?
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_method_closest_power_of_2
|
11
|
-
assert_equal 8, 6.closest_power_of_2
|
12
|
-
assert_equal 16, 13.closest_power_of_2
|
13
|
-
assert_equal 32, 24.closest_power_of_2
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
|