ipcat 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -15,14 +15,14 @@ Or with rubygems:
15
15
 
16
16
  ## Usage
17
17
 
18
- IPCat.matches?(ip_address)
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.matches?('8.18.145.0') # => instance of IPCat::IPRange
24
+ range = IPCat.datacenter?('8.18.145.0') # => instance of IPCat::IPRange
25
25
  range.name # => 'Amazon AWS'
26
26
 
27
- IPCat.matches?('127.0.0.1') # => nil
27
+ IPCat.datacenter?('127.0.0.1') # => nil
28
28
 
data/lib/ipcat.rb CHANGED
@@ -9,9 +9,10 @@ require 'ipcat/version'
9
9
 
10
10
  class IPCat
11
11
  class << self
12
- def matches?(ip)
12
+ def datacenter?(ip)
13
13
  bsearch(ip_to_integer(ip))
14
14
  end
15
+ alias_method :matches?, :datacenter?
15
16
 
16
17
  def ip_to_integer(ip)
17
18
  Integer === ip ? ip : IPAddr.new(ip).to_i
data/lib/ipcat/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class IPCat
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
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 '#matches?' do
17
- it("should match 1.2.3.0") { IPCat.matches?('1.2.3.0').must_be_instance_of IPCat::IPRange }
18
- it("should match 1.2.3.1") { IPCat.matches?('1.2.3.1').must_be_instance_of IPCat::IPRange }
19
- it("should match 1.2.3.1") { IPCat.matches?('1.2.3.1').must_be_instance_of IPCat::IPRange }
20
- it("should not match 1.1.1.1") { IPCat.matches?('1.1.1.1').must_be_nil }
21
- it("should not match 2.2.2.2") { IPCat.matches?('2.2.2.2').must_be_nil }
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ipcat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: