phonelib 0.6.46 → 0.6.47
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/data/extended_data.dat +0 -0
- data/data/phone_data.dat +0 -0
- data/lib/phonelib/core.rb +16 -0
- data/lib/phonelib/data_importer.rb +2 -2
- data/lib/phonelib/phone.rb +1 -1
- data/lib/phonelib/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94a9dc3f92bdda4df449b88b989c0b90f79b1fcdd6f4ffe1729aa4b9aefb2992
|
4
|
+
data.tar.gz: 01c8f2034b5451b696ba58be76db5cf4d61be25d467e46b57fd4cfee455e3325
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fa5f840b24ffbb506292a9577fb9832bc374dd22bc9096bef6f0685e9a86ba94ebf2230685790b5b4f046b64f19d7b90725ae15b2a36fa76fe5a511048fa563
|
7
|
+
data.tar.gz: 95841918b7173a4b8f93ad4939acc121a07cbb1c99a29064333666f50cad5548e02d4a4ad4f5afdaf34c0612cc3f563ba279cd9373157fbcaae8aed0224993d4
|
data/README.md
CHANGED
@@ -61,6 +61,12 @@ To disable sanitizing of passed phone number (keeping digits only)
|
|
61
61
|
Phonelib.strict_check = true
|
62
62
|
```
|
63
63
|
|
64
|
+
To change sanitized symbols on parsed number, so non-specified symbols won't be wiped and will fail the parsing
|
65
|
+
|
66
|
+
``` ruby
|
67
|
+
Phonelib.sanitize_regex = '[\.\-\(\) \;\+]'
|
68
|
+
```
|
69
|
+
|
64
70
|
To disable sanitizing of double prefix on passed phone number
|
65
71
|
|
66
72
|
```ruby
|
data/data/extended_data.dat
CHANGED
Binary file
|
data/data/phone_data.dat
CHANGED
Binary file
|
data/lib/phonelib/core.rb
CHANGED
@@ -107,6 +107,22 @@ module Phonelib
|
|
107
107
|
@@strict_check = strict
|
108
108
|
end
|
109
109
|
|
110
|
+
# @private sanitizing regex, matching symbols will get removed from parsed number, must be string
|
111
|
+
@@sanitize_regex = '[^0-9]+'
|
112
|
+
|
113
|
+
# getter for sanitize regex
|
114
|
+
# @return [String] regex of symbols to wipe from parsed number
|
115
|
+
def sanitize_regex
|
116
|
+
@@sanitize_regex
|
117
|
+
end
|
118
|
+
|
119
|
+
# setter for sanitize regex
|
120
|
+
# @param regex [String] symbols to wipe from parsed number
|
121
|
+
# @return [String] regex of symbols to wipe from parsed number
|
122
|
+
def sanitize_regex=(regex)
|
123
|
+
@@sanitize_regex = regex.is_a?(String) ? regex : regex.to_s
|
124
|
+
end
|
125
|
+
|
110
126
|
# @private strict double prefix check for validator, doesn't sanitize number
|
111
127
|
@@strict_double_prefix_check = false
|
112
128
|
|
@@ -145,10 +145,10 @@ module Phonelib
|
|
145
145
|
|
146
146
|
require 'open-uri'
|
147
147
|
require 'csv'
|
148
|
-
io = open('http://
|
148
|
+
io = open('http://api.geonames.org/countryInfoCSV?username=demo&style=full')
|
149
149
|
csv = CSV.new(io, {col_sep: "\t"})
|
150
150
|
csv.each do |row|
|
151
|
-
next if row[0].start_with?('#') || row[0].empty?
|
151
|
+
next if row[0].nil? || row[0].start_with?('#') || row[0].empty?
|
152
152
|
|
153
153
|
@countries[row[0]] = row[4]
|
154
154
|
end
|
data/lib/phonelib/phone.rb
CHANGED
data/lib/phonelib/version.rb
CHANGED
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.6.
|
4
|
+
version: 0.6.47
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vadim Senderovich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: '0'
|
170
170
|
requirements: []
|
171
|
-
rubygems_version: 3.0.
|
171
|
+
rubygems_version: 3.0.9
|
172
172
|
signing_key:
|
173
173
|
specification_version: 4
|
174
174
|
summary: Gem validates phone numbers with Google libphonenumber database
|