phony 2.9.0 → 2.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 117a11d3df055c88a892d0cbb32a1106e72d2ed6
|
|
4
|
+
data.tar.gz: 6b9d3d5ab8e6e2c1559a0b670865fb9727006492
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4cc3f3eed1456898a67e536a3a996b3a32ea81b10fcbec18082a80d0dcf096a41bf731ffb4822bc66a03f48d16df350aee5a2b1696b3a0a1b690c1a3d42bdb3a
|
|
7
|
+
data.tar.gz: 1fa24b6a8326fe7989b3f8f25be1af5a101238515c87fa2d39b3f08f50593263f17ba470d8ae97aa712b26c52b48304b4fe68860d6f5ef8516ef60fcb650f603
|
|
@@ -110,19 +110,19 @@ ndcs_with_6_subscriber_digits = %w(3012 3022 3412 3435 3439 3452 3456 3462 3463
|
|
|
110
110
|
862 8634 8635 8636 8639 8652 8662 8672 8712 8722 8732 8772 8782 8793
|
|
111
111
|
)
|
|
112
112
|
|
|
113
|
-
ndcs_with_7_subscriber_digits = %w(342 343 347 351 383 391 473 495 496 498 499 812 818 831 843 844 846 861 862 863
|
|
114
|
-
901 902 903 904 905 906 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929
|
|
115
|
-
930 931 932 933 934 936 937 938 950 951 952 953 960 961 962 963 964 965 967 968 980 981 982 983 984 985 987 988
|
|
113
|
+
ndcs_with_7_subscriber_digits = %w(342 343 347 351 383 391 473 495 496 498 499 812 818 831 843 844 846 861 862 863
|
|
114
|
+
901 902 903 904 905 906 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929
|
|
115
|
+
930 931 932 933 934 936 937 938 950 951 952 953 960 961 962 963 964 965 967 968 980 981 982 983 984 985 987 988
|
|
116
116
|
989 997
|
|
117
117
|
)
|
|
118
118
|
|
|
119
119
|
Phony.define do
|
|
120
|
-
country '7',
|
|
120
|
+
country '7',
|
|
121
121
|
trunk('8', normalize: false) |
|
|
122
|
-
one_of(ndcs_with_5_subscriber_digits) >> split(1,
|
|
123
|
-
one_of(ndcs_with_6_subscriber_digits) >> split(2,
|
|
124
|
-
one_of(ndcs_with_7_subscriber_digits) >> split(3,
|
|
125
|
-
one_of(%w(800)) >> split(3,
|
|
122
|
+
one_of(ndcs_with_5_subscriber_digits) >> split(1, 2, 2) |
|
|
123
|
+
one_of(ndcs_with_6_subscriber_digits) >> split(2, 2, 2) |
|
|
124
|
+
one_of(ndcs_with_7_subscriber_digits) >> split(3, 2, 2) |
|
|
125
|
+
one_of(%w(800)) >> split(3, 2, 2) | # Russia free number
|
|
126
126
|
one_of(%w(995344 9971 99744 9976 997)) >> split(2, 4) | # South Osetia
|
|
127
127
|
fixed(3) >> split(2, 5)
|
|
128
128
|
end
|
|
@@ -7,7 +7,7 @@ describe 'Phony#format' do
|
|
|
7
7
|
Phony.formatted('41443643532').should eql '+41 44 364 35 32'
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
describe 'with templates' do
|
|
12
12
|
it 'handles a basic template correctly' do
|
|
13
13
|
Phony.format('41443643532', :format => 'A%{cc}B%{ndc}C%{local}').should eql 'A41B44C364 35 32'
|
|
@@ -25,7 +25,7 @@ describe 'Phony#format' do
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
describe 'cases' do
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
describe 'exceptions' do
|
|
30
30
|
it 'raises on nil' do
|
|
31
31
|
expect {
|
|
@@ -70,13 +70,13 @@ describe 'Phony#format' do
|
|
|
70
70
|
Phony.format(Phony.normalize('+370 800 12345'), :format => :international).should eql '+370 800 12 345'
|
|
71
71
|
end
|
|
72
72
|
it 'should format Russian numbers' do
|
|
73
|
-
Phony.format(Phony.normalize('+7 812 123 4567'), :format => :international).should eql '+7 812 123
|
|
73
|
+
Phony.format(Phony.normalize('+7 812 123 4567'), :format => :international).should eql '+7 812 123 45 67'
|
|
74
74
|
end
|
|
75
75
|
it 'should format Russian numbers' do
|
|
76
76
|
Phony.format(Phony.normalize('+370 800 12345'), :format => :national).should eql '8800 12 345'
|
|
77
77
|
end
|
|
78
78
|
it 'should format Russian numbers' do
|
|
79
|
-
Phony.format(Phony.normalize('+7 812 123 4567'), :format => :national).should eql '8812 123
|
|
79
|
+
Phony.format(Phony.normalize('+7 812 123 4567'), :format => :national).should eql '8812 123 45 67'
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
describe 'international' do
|
|
@@ -183,7 +183,7 @@ describe 'Phony#format' do
|
|
|
183
183
|
Phony.format('493038625454', :format => :local).should eql '386 25454'
|
|
184
184
|
end
|
|
185
185
|
end
|
|
186
|
-
|
|
186
|
+
|
|
187
187
|
end
|
|
188
188
|
|
|
189
189
|
end
|
|
@@ -527,10 +527,10 @@ describe 'country descriptions' do
|
|
|
527
527
|
it_splits '40249123123', ['40', '249', '123', '123'] # Olt
|
|
528
528
|
end
|
|
529
529
|
describe 'Russia' do
|
|
530
|
-
it_splits '78122345678', ['7', '812', '234', '
|
|
531
|
-
it_splits '74012771077', ['7', '4012', '77', '
|
|
532
|
-
it_splits '78402411212', ['7', '84024', '1', '
|
|
533
|
-
it_splits '79296119119', ['7', '929', '611', '
|
|
530
|
+
it_splits '78122345678', ['7', '812', '234', '56', '78'] # Russia 3-digit
|
|
531
|
+
it_splits '74012771077', ['7', '4012', '77', '10', '77'] # Russia 4-digit
|
|
532
|
+
it_splits '78402411212', ['7', '84024', '1', '12', '12'] # Russia 5-digit
|
|
533
|
+
it_splits '79296119119', ['7', '929', '611', '91', '19'] # Russia 3-digit, Megafon Mobile.
|
|
534
534
|
it_splits '7840121212', ['7', '840', '12', '1212'] # Abhasia
|
|
535
535
|
it_splits '7799121212', ['7', '799', '12', '1212'] # Kazachstan
|
|
536
536
|
it_splits '7995344121212', ['7','995344','12','1212'] # South Osetia
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: phony
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.9.
|
|
4
|
+
version: 2.9.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Hanke
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2015-01-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: 'Fast international phone number (E164 standard) normalizing, splitting
|
|
14
14
|
and formatting. Lots of formatting options: International (+.., 00..), national
|