ip 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ip.rb +2 -3
- data/lib/ip/address.rb +18 -4
- metadata +2 -2
data/lib/ip.rb
CHANGED
data/lib/ip/address.rb
CHANGED
@@ -43,6 +43,13 @@ end
|
|
43
43
|
#
|
44
44
|
|
45
45
|
class IP::Address::IPv4 < IP::Address
|
46
|
+
#
|
47
|
+
# Parses an IP address and stores it as the current address
|
48
|
+
#
|
49
|
+
def IPv4.parse(ip_address)
|
50
|
+
return IP::Address::IPv4.new(ip_address)
|
51
|
+
end
|
52
|
+
|
46
53
|
#
|
47
54
|
# Constructs an IP::Address::IPv4 object.
|
48
55
|
#
|
@@ -153,11 +160,10 @@ class IP::Address::IPv6 < IP::Address
|
|
153
160
|
end
|
154
161
|
|
155
162
|
@ip_address = ip_address
|
156
|
-
|
163
|
+
|
157
164
|
octets = parse_address(ip_address)
|
158
|
-
|
165
|
+
|
159
166
|
if octets.length != 8
|
160
|
-
puts octets
|
161
167
|
raise IP::AddressException.new("IPv6 address '#{ip_address}' does not have 8 octets or a floating range specifier")
|
162
168
|
end
|
163
169
|
|
@@ -169,6 +175,14 @@ class IP::Address::IPv6 < IP::Address
|
|
169
175
|
@octets = octets_atoi(octets)
|
170
176
|
end
|
171
177
|
|
178
|
+
#
|
179
|
+
# parses an ip address and stores it as the current object.
|
180
|
+
#
|
181
|
+
|
182
|
+
def IPv6.parse(ip_address)
|
183
|
+
return IP::Address::IPv6.new(ip_address)
|
184
|
+
end
|
185
|
+
|
172
186
|
#
|
173
187
|
# returns an octet in its hexidecimal representation.
|
174
188
|
#
|
@@ -242,7 +256,7 @@ class IP::Address::IPv6 < IP::Address
|
|
242
256
|
def pack
|
243
257
|
return IP::Address::Util.raw_pack(self.octets.dup)
|
244
258
|
end
|
245
|
-
|
259
|
+
|
246
260
|
protected
|
247
261
|
|
248
262
|
#
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ip
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.2.
|
7
|
-
date: 2006-
|
6
|
+
version: 0.2.1
|
7
|
+
date: 2006-04-20 00:00:00 -07:00
|
8
8
|
summary: Ruby classes to work with IP address, ranges, and netmasks
|
9
9
|
require_paths:
|
10
10
|
- lib
|