ip3country 0.1.1 → 0.2.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.
- checksums.yaml +4 -4
- data/lib/country_lookup.rb +24 -5
- metadata +6 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 78b3536e8481cda95c23ab45a43612308c4d6cbaa5e3c61050e46dcc079b52f1
|
|
4
|
+
data.tar.gz: 62214a88c865ff87166874df6f9fa9503eaa0e45122d2d4a85fa48de94a78af2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d1d3e2550e4d2b70f36e439ba135ac727560aaccb1cd3c8c93bc138409b9302f6518d0d164b6f278ee110869f1a57826a70fa4cfab78a13dd5bfe1404cee78ca
|
|
7
|
+
data.tar.gz: 5e68609330b91025d3bc8b3fa018fa92a0f80036d3388f7132fd4facefe0d9ccfee1e3e26ba1efe1858ca0086424d5391e30593494298b8e231cb7896fc62769
|
data/lib/country_lookup.rb
CHANGED
|
@@ -99,22 +99,41 @@ module CountryLookup
|
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
def self.initialize
|
|
102
|
-
|
|
102
|
+
if !@initialize_bg_thread.nil? && @initialize_bg_thread.alive?
|
|
103
|
+
@initialize_bg_thread.join
|
|
104
|
+
else
|
|
105
|
+
@lookup = Lookup.new
|
|
106
|
+
end
|
|
103
107
|
return nil
|
|
104
108
|
end
|
|
105
109
|
|
|
110
|
+
def self.initialize_async
|
|
111
|
+
if !@initialize_bg_thread.nil? && @initialize_bg_thread.alive?
|
|
112
|
+
return @initialize_bg_thread
|
|
113
|
+
end
|
|
114
|
+
@initialize_bg_thread = Thread.new { @lookup = Lookup.new }
|
|
115
|
+
return @initialize_bg_thread
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def self.is_ready_for_lookup
|
|
119
|
+
!@lookup.nil?
|
|
120
|
+
end
|
|
121
|
+
|
|
106
122
|
def self.lookup_ip_string(ip_string)
|
|
107
|
-
if
|
|
108
|
-
|
|
123
|
+
if !is_ready_for_lookup
|
|
124
|
+
initialize
|
|
109
125
|
end
|
|
110
126
|
@lookup.lookup_ip_string(ip_string)
|
|
111
127
|
end
|
|
112
128
|
|
|
113
129
|
def self.lookup_ip_number(ip_number)
|
|
114
|
-
if
|
|
115
|
-
|
|
130
|
+
if !is_ready_for_lookup
|
|
131
|
+
initialize
|
|
116
132
|
end
|
|
117
133
|
@lookup.lookup_ip_number(ip_number)
|
|
118
134
|
end
|
|
119
135
|
|
|
136
|
+
def teardown
|
|
137
|
+
@lookup = nil
|
|
138
|
+
end
|
|
120
139
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ip3country
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
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:
|
|
11
|
+
date: 2023-05-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -51,7 +51,7 @@ homepage: https://rubygems.org/gems/ip3country
|
|
|
51
51
|
licenses:
|
|
52
52
|
- ISC
|
|
53
53
|
metadata: {}
|
|
54
|
-
post_install_message:
|
|
54
|
+
post_install_message:
|
|
55
55
|
rdoc_options: []
|
|
56
56
|
require_paths:
|
|
57
57
|
- lib
|
|
@@ -66,9 +66,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
67
|
version: '0'
|
|
68
68
|
requirements: []
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
signing_key:
|
|
69
|
+
rubygems_version: 3.3.7
|
|
70
|
+
signing_key:
|
|
72
71
|
specification_version: 4
|
|
73
72
|
summary: ip3country for ruby
|
|
74
73
|
test_files: []
|