phonelib 0.8.4 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/extended_data.dat +0 -0
- data/data/phone_data.dat +0 -0
- data/lib/phonelib/core.rb +7 -0
- data/lib/phonelib/data_importer.rb +1 -1
- data/lib/phonelib/version.rb +1 -1
- data/lib/phonelib.rb +8 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85cd4f24c68ac6068113a435814644b935665fbb93e7272ac7ca8ea76ae15a71
|
4
|
+
data.tar.gz: 68985385d3e308bb5d1506b6ef4facd97792e9fea2018dd74802d5f2e2f9b15c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a54324348a4569f95986931c73eca14c528cd36a1842f35871658caddf9ef233144be3a8eceab34f554cf43de78d729b0dcd222c675bb64dfda0913cf84b2881
|
7
|
+
data.tar.gz: d10d62611b2876cd3e409c6d03474904359b7facf30e016e425fd5b116bb6c8cf4af619e47260c74aa612078a704cf93c18cc18ed0f8c54f296e4b6d0e7bb187
|
data/data/extended_data.dat
CHANGED
Binary file
|
data/data/phone_data.dat
CHANGED
Binary file
|
data/lib/phonelib/core.rb
CHANGED
@@ -4,6 +4,13 @@ module Phonelib
|
|
4
4
|
# @private variable will include hash with data for validation
|
5
5
|
@@phone_data = nil
|
6
6
|
|
7
|
+
# eagerly initialize the gem, loads data into memory. not required, initialization is done lazily otherwise, but
|
8
|
+
# may be desirable in production enviroments to avoid initialization time on first use.
|
9
|
+
def eager_load!
|
10
|
+
phone_data
|
11
|
+
phone_ext_data
|
12
|
+
end
|
13
|
+
|
7
14
|
# getter for phone data for other modules of gem, can be used outside
|
8
15
|
# @return [Hash] all data for phone parsing
|
9
16
|
def phone_data
|
@@ -197,7 +197,7 @@ module Phonelib
|
|
197
197
|
|
198
198
|
require 'open-uri'
|
199
199
|
require 'csv'
|
200
|
-
io = open('http://
|
200
|
+
io = URI.open('http://download.geonames.org/export/dump/countryInfo.txt')
|
201
201
|
csv = CSV.new(io, {col_sep: "\t"})
|
202
202
|
csv.each do |row|
|
203
203
|
next if row[0].nil? || row[0].start_with?('#') || row[0].empty? || row[0].size != 2
|
data/lib/phonelib/version.rb
CHANGED
data/lib/phonelib.rb
CHANGED
@@ -17,4 +17,12 @@ if defined?(ActiveModel) || defined?(Rails)
|
|
17
17
|
else
|
18
18
|
autoload :PhoneValidator, 'validators/phone_validator'
|
19
19
|
end
|
20
|
+
|
21
|
+
if defined?(Rails)
|
22
|
+
class Phonelib::Railtie < Rails::Railtie
|
23
|
+
initializer 'phonelib' do |app|
|
24
|
+
app.config.eager_load_namespaces << Phonelib
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
20
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phonelib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vadim Senderovich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: '1.15'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: '1.15'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.0.
|
75
|
+
version: 1.0.9
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.0.
|
82
|
+
version: 1.0.9
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: simplecov
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
197
|
- !ruby/object:Gem::Version
|
198
198
|
version: '0'
|
199
199
|
requirements: []
|
200
|
-
rubygems_version: 3.
|
200
|
+
rubygems_version: 3.1.4
|
201
201
|
signing_key:
|
202
202
|
specification_version: 4
|
203
203
|
summary: Gem validates phone numbers with Google libphonenumber database
|