ipaddr_range_set 0.10.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ec00c0b3c751451810209932ce2bed617eff7a32
4
+ data.tar.gz: 23d123fe53c6a1b4cf20a49d1677120e3a7d2b54
5
+ SHA512:
6
+ metadata.gz: eaaa198ba4f8279dd5e7fc695a897dc0133f95081f38f71a9a9cb55105498ab638ee691e0068277d65a0ea73b26172047503106a7317715eefb624b925256fa0
7
+ data.tar.gz: ae0e7544efef39c72de76941a42f3fda1c92c86ab468aed2c98ca9fdff98d34894916f654e437d009fb1caefd37ffcc57f1a29a7e28d79d6f291df621056b627
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.0
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ipaddr_range_set
2
2
  ================
3
+ [![Build Status](https://travis-ci.org/jrochkind/ipaddr_range_set.png)](https://travis-ci.org/jrochkind/ipaddr_range_set)
4
+
5
+
3
6
 
4
7
  convenience class to create a set of possibly discontiguous IP address range
5
8
  segments, and check if an IP address is in the set. ruby 1.9.3+ only.
@@ -93,4 +96,4 @@ is done (should it be? I have no idea, don't really understand ipv6 use cases).
93
96
  ## thanks
94
97
 
95
98
  to whoever wrote IPAddr in ruby stdlib, nice to have it, this is just a
96
- convenience wrapper over it, really.
99
+ convenience wrapper over it, really.
@@ -3,6 +3,11 @@ require "ipaddr_range_set/version"
3
3
  require 'ipaddr'
4
4
 
5
5
  class IPAddrRangeSet
6
+ # In ruby 2.0, they introduced IPAddr::InvalidAddressError, before
7
+ # that it was just ArgumentError. Let's throw it if we've got it
8
+ # to be consistent.
9
+ ArgErrorClass = (defined? IPAddr::InvalidAddressError) ? IPAddr::InvalidAddressError : ArgumentError
10
+
6
11
 
7
12
  # Zero or more segment arguments, which can be input in a variety of
8
13
  # of formats.
@@ -52,7 +57,7 @@ class IPAddrRangeSet
52
57
  octets = segment.split('.')
53
58
 
54
59
  if (octets.rindex {|o| o =~ /\d+/}) > octets.rindex("*")
55
- raise ArgumentError.new("Invalid splat range, all *s have to come before all concrete octets")
60
+ raise ArgErrorClass.new("Invalid splat range, all *s have to come before all concrete octets")
56
61
  end
57
62
 
58
63
  splats = 0
@@ -85,7 +90,7 @@ class IPAddrRangeSet
85
90
  segments.each do |segment|
86
91
  # important to use cover? and not include? on Ranges, to avoid
87
92
  # terribly inefficient check. But if segment is an IPAddr, you want include?
88
- if segment.respond_to?(:cover)
93
+ if segment.respond_to?(:cover?)
89
94
  return true if segment.cover? ip_addr
90
95
  else
91
96
  return true if segment.include? ip_addr
@@ -1,3 +1,3 @@
1
1
  module IpaddrRangeSet
2
- VERSION = "0.10.0"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -75,15 +75,19 @@ class TestIpAddrRange < Test::Unit::TestCase
75
75
  end
76
76
 
77
77
  def test_bad_input
78
- assert_raise(ArgumentError) { IPAddrRangeSet.new("foo")}
78
+ # ruby 2.0 IPAddr::InvalidAddressError is a subclass of ArgumentError,
79
+ # but minitest assert_raise insists on exact kind
80
+ exception_class = (defined? IPAddr::InvalidAddressError) ? IPAddr::InvalidAddressError : ArgumentError
81
+
82
+ assert_raise(exception_class) { IPAddrRangeSet.new("foo")}
79
83
 
80
- assert_raise(ArgumentError) { IPAddrRangeSet.new("124.*")}
84
+ assert_raise(exception_class) { IPAddrRangeSet.new("124.*")}
81
85
 
82
86
  # splats have to be at end
83
- assert_raise(ArgumentError) { IPAddrRangeSet.new("124.*.1.1")}
87
+ assert_raise(exception_class) { IPAddrRangeSet.new("124.*.1.1")}
84
88
 
85
89
  # Not a valid ipv4, make sure we catch it on ranges
86
- assert_raise(ArgumentError) { IPAddrRangeSet.new("124.999.1.1".."125.0.0.1") }
90
+ assert_raise(exception_class) { IPAddrRangeSet.new("124.999.1.1".."125.0.0.1") }
87
91
  end
88
92
 
89
93
  def test_multi_arg
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ipaddr_range_set
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jonathan Rochkind
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-11-12 00:00:00.000000000 Z
11
+ date: 2014-01-02 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description:
15
14
  email:
@@ -18,6 +17,7 @@ executables: []
18
17
  extensions: []
19
18
  extra_rdoc_files: []
20
19
  files:
20
+ - .travis.yml
21
21
  - Gemfile
22
22
  - README.md
23
23
  - Rakefile
@@ -27,29 +27,27 @@ files:
27
27
  - test/test_ip_addr_range_set.rb
28
28
  homepage: https://github.com/jrochkind/ipaddr_range_set
29
29
  licenses: []
30
+ metadata: {}
30
31
  post_install_message:
31
32
  rdoc_options: []
32
33
  require_paths:
33
34
  - lib
34
35
  required_ruby_version: !ruby/object:Gem::Requirement
35
- none: false
36
36
  requirements:
37
- - - ! '>='
37
+ - - '>='
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
40
  required_rubygems_version: !ruby/object:Gem::Requirement
41
- none: false
42
41
  requirements:
43
- - - ! '>='
42
+ - - '>='
44
43
  - !ruby/object:Gem::Version
45
44
  version: '0'
46
45
  requirements: []
47
46
  rubyforge_project:
48
- rubygems_version: 1.8.24
47
+ rubygems_version: 2.0.3
49
48
  signing_key:
50
- specification_version: 3
49
+ specification_version: 4
51
50
  summary: convenience class to create a set of possibly discontiguous IP address range
52
51
  segments, and check if an IP address is in the set.
53
52
  test_files:
54
53
  - test/test_ip_addr_range_set.rb
55
- has_rdoc: