ipcat 0.1.0 → 1.0.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/lib/ipcat.rb CHANGED
@@ -10,11 +10,11 @@ require 'ipcat/version'
10
10
  class IPCat
11
11
  class << self
12
12
  def matches?(ip)
13
- bsearch(ip_to_fixnum(ip))
13
+ bsearch(ip_to_integer(ip))
14
14
  end
15
15
 
16
- def ip_to_fixnum(ip)
17
- Fixnum === ip ? ip : IPAddr.new(ip).to_i
16
+ def ip_to_integer(ip)
17
+ Integer === ip ? ip : IPAddr.new(ip).to_i
18
18
  end
19
19
 
20
20
  def ranges
data/lib/ipcat/iprange.rb CHANGED
@@ -4,16 +4,16 @@ class IPCat
4
4
  attr_accessor :first, :last, :name, :url
5
5
 
6
6
  def initialize(first, last, name=nil, url=nil)
7
- @first = IPCat.ip_to_fixnum(first)
8
- @last = IPCat.ip_to_fixnum(last)
7
+ @first = IPCat.ip_to_integer(first)
8
+ @last = IPCat.ip_to_integer(last)
9
9
  @name, @url = name, url
10
10
  raise ArgumentError.new("first must be <= last") if @first > @last
11
11
  end
12
12
 
13
13
  def <=>(obj)
14
14
  case obj
15
- when Fixnum
16
- compare_with_fixnum(obj)
15
+ when Integer
16
+ compare_with_integer(obj)
17
17
  when IPRange
18
18
  # Assume all IPRanges are non-overlapping
19
19
  first <=> obj.first
@@ -21,7 +21,7 @@ class IPCat
21
21
  end
22
22
 
23
23
  protected
24
- def compare_with_fixnum(i)
24
+ def compare_with_integer(i)
25
25
  if first > i
26
26
  1
27
27
  elsif last < i
data/lib/ipcat/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class IPCat
2
- VERSION = '0.1.0'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -16,7 +16,7 @@ describe 'IPCat::IPRange' do
16
16
  end
17
17
  end
18
18
 
19
- describe '#<=> for fixnums' do
19
+ describe '#<=> for integers' do
20
20
  it("should match first") { (range <=> range.first).must_equal 0 }
21
21
  it("should match last") { (range <=> range.last).must_equal 0 }
22
22
  it("should match first-1") { (range <=> range.first - 1).must_equal 1 }
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: 0.1.0
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-01 00:00:00.000000000 Z
12
+ date: 2013-01-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest