telephone_number 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/geocoding/de/43.dat +0 -0
- data/data/geocoding/de/43.txt +9 -2
- data/data/geocoding/de/49.dat +0 -0
- data/data/geocoding/de/49.txt +2 -2
- data/data/geocoding/en/261.dat +0 -0
- data/data/geocoding/en/261.txt +0 -2
- data/data/geocoding/en/263.dat +0 -0
- data/data/geocoding/en/263.txt +9 -25
- data/data/geocoding/en/33.dat +0 -0
- data/data/geocoding/en/33.txt +28 -216
- data/data/geocoding/en/358.dat +0 -0
- data/data/geocoding/en/358.txt +1 -8
- data/data/geocoding/en/370.dat +0 -0
- data/data/geocoding/en/370.txt +1 -1
- data/data/geocoding/en/43.dat +0 -0
- data/data/geocoding/en/43.txt +9 -2
- data/data/geocoding/en/49.dat +0 -0
- data/data/geocoding/en/49.txt +2 -2
- data/data/geocoding/en/52.dat +0 -0
- data/data/geocoding/en/52.txt +12 -40
- data/data/geocoding/en/60.dat +0 -0
- data/data/geocoding/en/60.txt +32 -44
- data/data/geocoding/en/64.dat +0 -0
- data/data/geocoding/en/64.txt +18 -2
- data/data/geocoding/en/91.dat +0 -0
- data/data/geocoding/en/91.txt +12 -5
- data/data/geocoding/es/52.dat +0 -0
- data/data/geocoding/es/52.txt +11 -39
- data/data/geocoding/fi/358.dat +0 -0
- data/data/geocoding/fi/358.txt +1 -8
- data/data/geocoding/fr/33.dat +0 -0
- data/data/geocoding/fr/33.txt +28 -216
- data/data/geocoding/sv/358.dat +0 -0
- data/data/geocoding/sv/358.txt +1 -8
- data/data/telephone_number_data_file.dat +0 -0
- data/data/telephone_number_data_file.xml +2999 -2632
- data/data/timezones/map_data.dat +0 -0
- data/data/timezones/map_data.txt +64 -968
- data/lib/telephone_number/formatter.rb +11 -15
- data/lib/telephone_number/version.rb +1 -1
- metadata +2 -2
@@ -34,19 +34,15 @@ module TelephoneNumber
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def build_national_number(formatted: true)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
national_prefix_string.gsub!(/\$NP/, country.national_prefix.to_s)
|
45
|
-
national_prefix_string.gsub!(/\$FG/, captures[0])
|
46
|
-
formatted_string.sub!(captures[0], national_prefix_string)
|
37
|
+
national_prefix_formatting_rule = number_format.national_prefix_formatting_rule
|
38
|
+
formatted_number = if national_prefix_formatting_rule
|
39
|
+
national_prefix_formatting_rule = national_prefix_formatting_rule.sub(/\$NP/, country.national_prefix.to_s).sub(/\$FG/, '\\\1')
|
40
|
+
format = number_format.format.sub(/(\$\d)/, national_prefix_formatting_rule).gsub(/\$/, '\\\\')
|
41
|
+
normalized_number.sub(number_format.pattern, format)
|
42
|
+
else
|
43
|
+
normalized_number.sub(number_format.pattern, number_format.format.gsub(/\$/, '\\\\'))
|
47
44
|
end
|
48
|
-
|
49
|
-
formatted ? formatted_string : TelephoneNumber.sanitize(formatted_string)
|
45
|
+
formatted ? formatted_number : TelephoneNumber.sanitize(formatted_number)
|
50
46
|
end
|
51
47
|
|
52
48
|
def build_e164_number(formatted: true)
|
@@ -56,9 +52,9 @@ module TelephoneNumber
|
|
56
52
|
|
57
53
|
def build_international_number(formatted: true)
|
58
54
|
return original_or_default if !valid? || number_format.nil?
|
59
|
-
|
60
|
-
|
61
|
-
formatted_string = "+#{country.country_code} #{
|
55
|
+
format_to_use = number_format.intl_format || number_format.format
|
56
|
+
formatted_string = normalized_number.sub(number_format.pattern, format_to_use.gsub(/\$/, '\\\\'))
|
57
|
+
formatted_string = "+#{country.country_code} #{formatted_string}"
|
62
58
|
formatted ? formatted_string : TelephoneNumber.sanitize(formatted_string)
|
63
59
|
end
|
64
60
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: telephone_number
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MOBI Wireless Management
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|