phonelib 0.9.0 → 0.9.2
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/data_importer.rb +1 -1
- data/lib/phonelib/phone_analyzer.rb +1 -1
- data/lib/phonelib/phone_analyzer_helper.rb +1 -0
- data/lib/phonelib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8757503beb87b7e5f68f12655b3e94870db6a71a59e0a00517a8e28e20f0cb4
|
4
|
+
data.tar.gz: 7664e0a713b671f794489a8ea7e6a70638af68192ef733fa0bdc7fe21839673d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96611d6ac22d85ae18a26de3fc1bed00418193775d5a2d815a6b68ff3658bbc61d6794b5d11fd85defa2fb4d6687a7c1dd3c4d14de6279174ae0adcc3a5bd20f
|
7
|
+
data.tar.gz: 9d48a4dfa707f1aaea3fe3932bf0518c1fc2bf59e749c6fe85fb0b343b014541f2d9e3cc549f9b38f97d3ea65c6d8e6ee13cfd27849fc6135c0e80e75e750070
|
data/data/extended_data.dat
CHANGED
Binary file
|
data/data/phone_data.dat
CHANGED
Binary file
|
@@ -209,7 +209,7 @@ module Phonelib
|
|
209
209
|
# adds double country code flag in case country allows
|
210
210
|
def add_double_country_flag(country)
|
211
211
|
if DOUBLE_COUNTRY_CODES_COUNTRIES.include?(country[:id])
|
212
|
-
country[
|
212
|
+
country[Core::DOUBLE_COUNTRY_PREFIX_FLAG] = true
|
213
213
|
end
|
214
214
|
country
|
215
215
|
end
|
@@ -70,7 +70,7 @@ module Phonelib
|
|
70
70
|
# replacing national prefix to simplified format
|
71
71
|
def with_replaced_national_prefix(phone, data)
|
72
72
|
return phone unless data[Core::NATIONAL_PREFIX_TRANSFORM_RULE]
|
73
|
-
phone = phone.gsub(/^#{data[Core::COUNTRY_CODE]}/, '') if phone.start_with?(data[Core::COUNTRY_CODE])
|
73
|
+
phone = phone.gsub(/^#{data[Core::COUNTRY_CODE]}/, '') if phone.start_with?(data[Core::COUNTRY_CODE]) && !data[Core::DOUBLE_COUNTRY_PREFIX_FLAG]
|
74
74
|
pattern = cr("^(?:#{data[Core::NATIONAL_PREFIX_FOR_PARSING]})")
|
75
75
|
match = phone.match pattern
|
76
76
|
if match && match.captures.compact.size > 0
|
@@ -8,6 +8,7 @@ module Phonelib
|
|
8
8
|
result
|
9
9
|
else
|
10
10
|
matched_countries = country_or_default_country(nil) & result.keys
|
11
|
+
matched_countries = result.keys.take(1) if matched_countries.size == 0
|
11
12
|
result = result.keep_if {|k, _v| matched_countries.include?(k) } if matched_countries
|
12
13
|
Hash[result.take(1)]
|
13
14
|
end
|
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.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vadim Senderovich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|