ipcat 1.0.0 → 1.0.1
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/README.md +3 -3
- data/lib/ipcat.rb +2 -1
- data/lib/ipcat/version.rb +1 -1
- data/spec/ipcat_spec.rb +6 -6
- metadata +1 -1
data/README.md
CHANGED
@@ -15,14 +15,14 @@ Or with rubygems:
|
|
15
15
|
|
16
16
|
## Usage
|
17
17
|
|
18
|
-
IPCat.
|
18
|
+
IPCat.datacenter?(ip_address)
|
19
19
|
|
20
20
|
It will return an IPCat::IPRange if ip_address is from a known datacenter; nil otherwise.
|
21
21
|
|
22
22
|
For example,
|
23
23
|
|
24
|
-
range = IPCat.
|
24
|
+
range = IPCat.datacenter?('8.18.145.0') # => instance of IPCat::IPRange
|
25
25
|
range.name # => 'Amazon AWS'
|
26
26
|
|
27
|
-
IPCat.
|
27
|
+
IPCat.datacenter?('127.0.0.1') # => nil
|
28
28
|
|
data/lib/ipcat.rb
CHANGED
data/lib/ipcat/version.rb
CHANGED
data/spec/ipcat_spec.rb
CHANGED
@@ -13,12 +13,12 @@ describe 'IPCat' do
|
|
13
13
|
it("has a range") { IPCat.ranges.size.must_equal 1 }
|
14
14
|
end
|
15
15
|
|
16
|
-
describe '#
|
17
|
-
it("should match 1.2.3.0") { IPCat.
|
18
|
-
it("should match 1.2.3.1") { IPCat.
|
19
|
-
it("should match 1.2.3.1") { IPCat.
|
20
|
-
it("should not match 1.1.1.1") { IPCat.
|
21
|
-
it("should not match 2.2.2.2") { IPCat.
|
16
|
+
describe '#datacenter?' do
|
17
|
+
it("should match 1.2.3.0") { IPCat.datacenter?('1.2.3.0').must_be_instance_of IPCat::IPRange }
|
18
|
+
it("should match 1.2.3.1") { IPCat.datacenter?('1.2.3.1').must_be_instance_of IPCat::IPRange }
|
19
|
+
it("should match 1.2.3.1") { IPCat.datacenter?('1.2.3.1').must_be_instance_of IPCat::IPRange }
|
20
|
+
it("should not match 1.1.1.1") { IPCat.datacenter?('1.1.1.1').must_be_nil }
|
21
|
+
it("should not match 2.2.2.2") { IPCat.datacenter?('2.2.2.2').must_be_nil }
|
22
22
|
end
|
23
23
|
|
24
24
|
end
|