ip3country 0.1.0 → 0.1.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.
- checksums.yaml +4 -4
- data/lib/country_lookup.rb +5 -5
- metadata +36 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2426c765f98336f9f1f7816ef0ed6c13e400c03cc1fa82f1b12d26099a77df47
|
|
4
|
+
data.tar.gz: 359e4b1312ca83f545b7263de0aba428cdd8751ef86f0e62834f820d7f8c7f1e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e060746e95e27d888f2a3a58336bf480df6d23dbf981de49452745f92174a1b433c72d2b2fbb77e364e74f55e3a3f05d1550fb7ef6caec6e77bafd3b0a437dbb
|
|
7
|
+
data.tar.gz: e815486b7c23ff24521b0b9513eed013eb6920116b8c5b46d743115093ee2428dc7e4bbe15d91344e9d256b6782e3950a40776fd9a126c18a457d70e9b3950f3
|
data/lib/country_lookup.rb
CHANGED
|
@@ -2,6 +2,9 @@ module CountryLookup
|
|
|
2
2
|
|
|
3
3
|
class Lookup
|
|
4
4
|
def initialize
|
|
5
|
+
@country_codes = Array.new
|
|
6
|
+
@ip_ranges = Array.new
|
|
7
|
+
@country_table = Array.new
|
|
5
8
|
initialize_from_file
|
|
6
9
|
end
|
|
7
10
|
|
|
@@ -23,7 +26,7 @@ module CountryLookup
|
|
|
23
26
|
end
|
|
24
27
|
|
|
25
28
|
def lookup_ip_number(ip_number)
|
|
26
|
-
index =
|
|
29
|
+
index = binary_search(ip_number)
|
|
27
30
|
cc = @country_codes[index]
|
|
28
31
|
if cc == '--'
|
|
29
32
|
return nil
|
|
@@ -55,12 +58,9 @@ module CountryLookup
|
|
|
55
58
|
# 242.n2.n3.c: if n >= 240 but < 65536. n2 being lower order byte
|
|
56
59
|
# 243.n2.n3.n4.c: if n >= 65536. n2 being lower order byte
|
|
57
60
|
def initialize_from_file
|
|
58
|
-
unless @country_codes.
|
|
61
|
+
unless @country_codes.length == 0
|
|
59
62
|
return
|
|
60
63
|
end
|
|
61
|
-
@country_codes = Array.new
|
|
62
|
-
@ip_ranges = Array.new
|
|
63
|
-
@country_table = Array.new
|
|
64
64
|
|
|
65
65
|
File.open(File.dirname(__FILE__) + '/ip_supalite.table') do |file|
|
|
66
66
|
until file.eof?
|
metadata
CHANGED
|
@@ -1,15 +1,43 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ip3country
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Statsig, Inc
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
-
dependencies:
|
|
11
|
+
date: 2022-10-03 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2.1'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2.1'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: minitest
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '5.14'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '5.14'
|
|
13
41
|
description: A ruby, zero-dependency, super small version of IP2Location LITE country
|
|
14
42
|
lookups
|
|
15
43
|
email: support@statsig.com
|
|
@@ -23,7 +51,7 @@ homepage: https://rubygems.org/gems/ip3country
|
|
|
23
51
|
licenses:
|
|
24
52
|
- ISC
|
|
25
53
|
metadata: {}
|
|
26
|
-
post_install_message:
|
|
54
|
+
post_install_message:
|
|
27
55
|
rdoc_options: []
|
|
28
56
|
require_paths:
|
|
29
57
|
- lib
|
|
@@ -38,8 +66,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
38
66
|
- !ruby/object:Gem::Version
|
|
39
67
|
version: '0'
|
|
40
68
|
requirements: []
|
|
41
|
-
|
|
42
|
-
|
|
69
|
+
rubyforge_project:
|
|
70
|
+
rubygems_version: 2.7.6.3
|
|
71
|
+
signing_key:
|
|
43
72
|
specification_version: 4
|
|
44
73
|
summary: ip3country for ruby
|
|
45
74
|
test_files: []
|