phonelib 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phonelib/phone_analyzer_helper.rb +4 -1
- 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: 6788d5bcd52e5f525a0405906a60ccb2a8443c0303905344ca37557d5765f51a
|
4
|
+
data.tar.gz: 22d467bb889ce0e4fcde42cf82d2e9c6a0f5466e923a8acc8416ac805d53c876
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53bfc909baa588bad634aa4ba0a43416471fe372936613f50ddb07a84b961f4ddc69ebec7e0288b526060cef5b350f2d5780fa1d4ae26def0399fe0c2f968973
|
7
|
+
data.tar.gz: 9671de06ef3f2d6c34284ca988b132098c177627babeee6c40bf8305b4639250f2afb5d3f494f35deac4b3a363437bac35525913490914bd57f15a395a3a88a2
|
@@ -7,6 +7,8 @@ module Phonelib
|
|
7
7
|
if result.size == 1
|
8
8
|
result
|
9
9
|
else
|
10
|
+
matched_countries = country_or_default_country(nil) & result.keys
|
11
|
+
result = result.keep_if {|k, _v| matched_countries.include?(k) } if matched_countries
|
10
12
|
Hash[result.take(1)]
|
11
13
|
end
|
12
14
|
end
|
@@ -56,7 +58,7 @@ module Phonelib
|
|
56
58
|
def country_can_dp?(country)
|
57
59
|
Phonelib.phone_data[country] &&
|
58
60
|
Phonelib.phone_data[country][Core::DOUBLE_COUNTRY_PREFIX_FLAG] &&
|
59
|
-
!original_starts_with_plus?
|
61
|
+
!original_starts_with_plus? && original_s.start_with?(Phonelib.phone_data[country][Core::COUNTRY_CODE])
|
60
62
|
end
|
61
63
|
|
62
64
|
# changes phone to with/without double country prefix
|
@@ -66,6 +68,7 @@ module Phonelib
|
|
66
68
|
|
67
69
|
country_code = Phonelib.phone_data[country][Core::COUNTRY_CODE]
|
68
70
|
if phone.start_with? country_code * 2
|
71
|
+
# remove double prefix in case it is there
|
69
72
|
phone.gsub(cr("^#{country_code}"), '')
|
70
73
|
else
|
71
74
|
"#{country_code}#{phone}"
|
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.8.
|
4
|
+
version: 0.8.1
|
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-04-
|
11
|
+
date: 2023-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|