trifle 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: .
11
11
  specs:
12
- trifle (0.0.3)
12
+ trifle (0.0.5)
13
13
 
14
14
  GEM
15
15
  remote: http://rubygems.org/
data/README.md CHANGED
@@ -44,7 +44,7 @@ trifle = Trifle.new(Redis.new, key: "foobar")
44
44
  You can also load the Trifle from the command line:
45
45
 
46
46
  ```
47
- trifle file1.csv file2.csv
47
+ trifle redis://127.0.0.1:6379/0 file1.csv file2.csv
48
48
  ```
49
49
 
50
50
  ### Lookup
@@ -65,6 +65,8 @@ trifle.find "192.168.1.1"
65
65
 
66
66
  ## Release notes
67
67
 
68
+ * **0.0.5** Fixed bug when finding IPs at the edge of the data set
69
+ * **0.0.4** Changed binary syntax
68
70
  * **0.0.3** Added a binary for loading Trifle from the command line
69
71
  * **0.0.2** Added support for custom Redis key
70
72
  * **0.0.1** First draft
data/lib/trifle/finder.rb CHANGED
@@ -13,7 +13,7 @@ class Trifle
13
13
  protected
14
14
 
15
15
  def find ip_i, lower, upper
16
- return nil if lower > upper
16
+ return nil if lower >= upper
17
17
 
18
18
  index = (lower+upper)/2
19
19
 
@@ -1,3 +1,3 @@
1
1
  class Trifle
2
- VERSION = "0.0.4" unless defined? Trifle::VERSION
2
+ VERSION = "0.0.5" unless defined? Trifle::VERSION
3
3
  end
@@ -17,9 +17,9 @@ describe Trifle::Finder do
17
17
  ["223.255.255.0","223.255.255.255","3758096128","3758096383","AU","Australia"]
18
18
  ]
19
19
  @redis = Redis.new
20
- trifle = Trifle.new(@redis)
20
+ @trifle = Trifle.new(@redis)
21
21
  @finder = Trifle::Finder.new(@redis)
22
- trifle.load(data: @valid_data)
22
+ @trifle.load(data: @valid_data)
23
23
  end
24
24
 
25
25
  describe "#handle" do
@@ -32,6 +32,11 @@ describe Trifle::Finder do
32
32
  it "should return nil if the entry wasn't found" do
33
33
  @finder.handle("127.0.0.1").should be_nil
34
34
  end
35
+
36
+ it "should not fail if there's only 1 record" do
37
+ @trifle.load(data: [["82.132.242.55","82.132.242.55","1384444471","1384444471","GB","United Kingdrom"]])
38
+ @finder.handle("127.0.0.1").should be_nil
39
+ end
35
40
  end
36
41
 
37
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trifle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-06-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70309726715860 !ruby/object:Gem::Requirement
16
+ requirement: &70169180633800 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70309726715860
24
+ version_requirements: *70169180633800
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rujitsu
27
- requirement: &70309726715260 !ruby/object:Gem::Requirement
27
+ requirement: &70169180632840 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70309726715260
35
+ version_requirements: *70169180632840
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: active_support
38
- requirement: &70309726714540 !ruby/object:Gem::Requirement
38
+ requirement: &70169180632020 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70309726714540
46
+ version_requirements: *70169180632020
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: fakeredis
49
- requirement: &70309726713980 !ruby/object:Gem::Requirement
49
+ requirement: &70169180631100 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 0.3.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70309726713980
57
+ version_requirements: *70169180631100
58
58
  description: Stores the GeoIP databases in Redis and gives it a simple way to lookup
59
59
  IPs and map them to countries
60
60
  email: