phony 2.20.13 → 2.20.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phony/config.rb +25 -26
- data/lib/phony/countries/argentina.rb +311 -314
- data/lib/phony/countries/austria.rb +71 -72
- data/lib/phony/countries/bangladesh.rb +27 -28
- data/lib/phony/countries/belarus.rb +110 -111
- data/lib/phony/countries/brazil.rb +92 -92
- data/lib/phony/countries/cambodia.rb +9 -9
- data/lib/phony/countries/china.rb +22 -21
- data/lib/phony/countries/croatia.rb +6 -5
- data/lib/phony/countries/georgia.rb +84 -84
- data/lib/phony/countries/germany.rb +4067 -4068
- data/lib/phony/countries/guinea.rb +8 -8
- data/lib/phony/countries/india.rb +31 -34
- data/lib/phony/countries/indonesia.rb +57 -46
- data/lib/phony/countries/ireland.rb +4 -5
- data/lib/phony/countries/italy.rb +54 -53
- data/lib/phony/countries/japan.rb +456 -456
- data/lib/phony/countries/kyrgyzstan.rb +109 -109
- data/lib/phony/countries/latvia.rb +34 -34
- data/lib/phony/countries/libya.rb +106 -106
- data/lib/phony/countries/malaysia.rb +12 -12
- data/lib/phony/countries/moldova.rb +42 -42
- data/lib/phony/countries/montenegro.rb +24 -20
- data/lib/phony/countries/myanmar.rb +39 -39
- data/lib/phony/countries/namibia.rb +35 -29
- data/lib/phony/countries/nepal.rb +60 -62
- data/lib/phony/countries/netherlands.rb +13 -13
- data/lib/phony/countries/pakistan.rb +135 -111
- data/lib/phony/countries/paraguay.rb +135 -135
- data/lib/phony/countries/russia_kazakhstan_abkhasia_south_ossetia.rb +125 -128
- data/lib/phony/countries/saudi_arabia.rb +5 -5
- data/lib/phony/countries/serbia.rb +47 -39
- data/lib/phony/countries/somalia.rb +18 -18
- data/lib/phony/countries/south_korea.rb +16 -13
- data/lib/phony/countries/sweden.rb +28 -28
- data/lib/phony/countries/taiwan.rb +20 -19
- data/lib/phony/countries/tajikistan.rb +70 -70
- data/lib/phony/countries/turkmenistan.rb +65 -65
- data/lib/phony/countries/ukraine.rb +607 -607
- data/lib/phony/countries/united_kingdom.rb +66 -66
- data/lib/phony/countries/uruguay.rb +40 -41
- data/lib/phony/countries/vietnam.rb +18 -17
- data/lib/phony/countries/zimbabwe.rb +31 -31
- data/lib/phony/countries.rb +440 -443
- data/lib/phony/country.rb +42 -44
- data/lib/phony/country_codes.rb +61 -60
- data/lib/phony/dsl.rb +23 -26
- data/lib/phony/local_splitters/fixed.rb +20 -29
- data/lib/phony/local_splitters/regex.rb +28 -31
- data/lib/phony/national_code.rb +7 -10
- data/lib/phony/national_splitters/default.rb +9 -11
- data/lib/phony/national_splitters/dsl.rb +8 -18
- data/lib/phony/national_splitters/fixed.rb +11 -14
- data/lib/phony/national_splitters/none.rb +7 -11
- data/lib/phony/national_splitters/regex.rb +13 -17
- data/lib/phony/national_splitters/variable.rb +36 -38
- data/lib/phony/trunk_code.rb +16 -18
- data/lib/phony/vanity.rb +12 -13
- data/lib/phony.rb +84 -84
- metadata +5 -39
- data/spec/functional/config_spec.rb +0 -44
- data/spec/functional/plausibility_spec.rb +0 -689
- data/spec/lib/phony/countries_spec.rb +0 -1459
- data/spec/lib/phony/country_codes_spec.rb +0 -227
- data/spec/lib/phony/country_spec.rb +0 -104
- data/spec/lib/phony/dsl_spec.rb +0 -28
- data/spec/lib/phony/local_splitters/fixed_spec.rb +0 -56
- data/spec/lib/phony/local_splitters/regex_spec.rb +0 -94
- data/spec/lib/phony/national_code_spec.rb +0 -61
- data/spec/lib/phony/national_splitters/default_spec.rb +0 -34
- data/spec/lib/phony/national_splitters/fixed_spec.rb +0 -45
- data/spec/lib/phony/national_splitters/none_spec.rb +0 -28
- data/spec/lib/phony/national_splitters/regex_spec.rb +0 -23
- data/spec/lib/phony/national_splitters/variable_spec.rb +0 -35
- data/spec/lib/phony/trunk_code_spec.rb +0 -85
- data/spec/lib/phony/vanity_spec.rb +0 -30
- data/spec/lib/phony_spec.rb +0 -70
@@ -31,7 +31,7 @@ ndcs = [
|
|
31
31
|
'72', # Kratie
|
32
32
|
'73', # Mondulkiri
|
33
33
|
'74', # Stung Treng
|
34
|
-
'75'
|
34
|
+
'75' # Ratanakiri
|
35
35
|
]
|
36
36
|
|
37
37
|
six_digit_mobile_prefixes = [
|
@@ -63,7 +63,7 @@ six_digit_mobile_prefixes = [
|
|
63
63
|
'93', # Smart
|
64
64
|
'95', # Mobitel
|
65
65
|
'98', # Smart
|
66
|
-
'99'
|
66
|
+
'99' # Mobitel
|
67
67
|
]
|
68
68
|
|
69
69
|
six_digit_extended_range_mobile_prefixes = [
|
@@ -79,7 +79,7 @@ seven_digit_mobile_prefixes = [
|
|
79
79
|
'76', # Mobitel
|
80
80
|
'88', # Metfone
|
81
81
|
'96', # Smart
|
82
|
-
'97'
|
82
|
+
'97' # Metfone
|
83
83
|
]
|
84
84
|
|
85
85
|
variable_length_extended_range_mobile_prefixes = [
|
@@ -91,7 +91,7 @@ six_digit_total_single_digit_fixed_line_prefixes = [
|
|
91
91
|
'3', # Mobitel
|
92
92
|
'7', # Telecom Cambodia
|
93
93
|
'8', # Telecom Cambodia
|
94
|
-
'9'
|
94
|
+
'9' # Camintel
|
95
95
|
]
|
96
96
|
|
97
97
|
six_digit_total_double_digit_fixed_line_prefixes = [
|
@@ -99,11 +99,11 @@ six_digit_total_double_digit_fixed_line_prefixes = [
|
|
99
99
|
'41', # Telecom Cambodia
|
100
100
|
'42', # Telecom Cambodia
|
101
101
|
'43', # Telecom Cambodia
|
102
|
-
'44'
|
102
|
+
'44' # Telecom Cambodia
|
103
103
|
]
|
104
104
|
|
105
105
|
seven_digit_total_single_digit_fixed_line_prefixes = [
|
106
|
-
'6'
|
106
|
+
'6' # Metfone
|
107
107
|
]
|
108
108
|
|
109
109
|
seven_digit_total_double_digit_fixed_line_prefixes = [
|
@@ -118,13 +118,13 @@ seven_digit_total_double_digit_fixed_line_prefixes = [
|
|
118
118
|
'53', # Mobitel
|
119
119
|
'54', # Mobitel
|
120
120
|
'55', # Mobitel
|
121
|
-
'56'
|
121
|
+
'56' # Smart
|
122
122
|
]
|
123
123
|
|
124
124
|
Phony.define do
|
125
|
-
country '855', trunk('0', :
|
125
|
+
country '855', trunk('0', normalize: true) |
|
126
126
|
one_of(variable_length_extended_range_mobile_prefixes) >> matched_split(/^1/ => [3, 4], /^[2-9]/ => [3, 3]) |
|
127
|
-
one_of(six_digit_mobile_prefixes)
|
127
|
+
one_of(six_digit_mobile_prefixes) >> matched_split(/^[2-9]/ => [3, 3]) |
|
128
128
|
one_of(six_digit_extended_range_mobile_prefixes) >> matched_split(/^[1-9]/ => [3, 3]) |
|
129
129
|
one_of(seven_digit_mobile_prefixes) >> matched_split(/^[2-9]/ => [3, 4]) |
|
130
130
|
one_of(ndcs) >> matched_split(/^(#{seven_digit_total_double_digit_fixed_line_prefixes.join('|')})\d{5}$/ => [3, 4], /^(#{seven_digit_total_single_digit_fixed_line_prefixes.join('|')})\d{6}$/ => [3, 4], /^(#{six_digit_total_double_digit_fixed_line_prefixes.join('|')})\d{4}$/ => [3, 3], /^(#{six_digit_total_single_digit_fixed_line_prefixes.join('|')})\d{5}$/ => [3, 3])
|
@@ -7,29 +7,30 @@
|
|
7
7
|
# Note: Tibet partially uses 4-digit NDC codes. This is NOT YET reflected here.
|
8
8
|
#
|
9
9
|
ndcs = [
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
10
|
+
'10', # Beijing, TODO Confirm – is it 10 or 1?
|
11
|
+
'20', # Guangzhou
|
12
|
+
'21', # Shanghai
|
13
|
+
'22', # Tianjin
|
14
|
+
'23', # Chongquin
|
15
|
+
'24', # Shenyang
|
16
|
+
'25', # Nanjing
|
17
|
+
'26', # Taipei, Taiwan - gotta be kidding, right?!
|
18
|
+
'27', # Wuhan
|
19
|
+
'28', # Chengdu
|
20
|
+
'29' # Xi'an
|
21
21
|
]
|
22
|
-
mobile = %w
|
23
|
-
|
22
|
+
mobile = %w[130 131 132 133 134 135 136 137 138 139 145 146 147 148 149 150 151 152 153 155 156 157 158 159 162 165 166
|
23
|
+
167 170 171 172 173 174 175 176 177 178 180 181 182 183 184 185 186 187 188 189 190 191 192 193 195 196 197 198 199 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349]
|
24
|
+
service = %w[110 114 119 120 122 999] # Probably not exhaustive. TODO Look at http://www.eoc.com.cn/?action-viewnews-itemid-11493.
|
24
25
|
|
25
26
|
Phony.define do
|
26
27
|
country '86',
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
28
|
+
trunk('0') |
|
29
|
+
one_of(service) >> split(8) |
|
30
|
+
one_of(mobile) >> split(4, 4) |
|
31
|
+
one_of(ndcs) >> split(4, 4) |
|
32
|
+
fixed(3) >> matched_split(
|
33
|
+
/\A\d{7}\z/ => [3, 4],
|
34
|
+
/\A\d{8}\z/ => [4, 4]
|
35
|
+
)
|
35
36
|
end
|
@@ -12,12 +12,13 @@ landline = /^(2[0-3]|3[1-5]|4[02-47-9]|5[1-3])/
|
|
12
12
|
|
13
13
|
Phony.define do
|
14
14
|
country '385', trunk('0') |
|
15
|
-
one_of('1') >> split(4, 3)
|
15
|
+
one_of('1') >> split(4, 3) | # Zagreb
|
16
16
|
match(/^(80[01])/) >> matched_split(
|
17
|
-
|
18
|
-
|
17
|
+
/\A\d{4}\z/ => [4],
|
18
|
+
/\A\d{6}\z/ => [3, 3]
|
19
|
+
) | # Toll free
|
19
20
|
match(/^(9\d)/) >> split(3, 3..4) | # Mobile
|
20
21
|
match(landline) >> split(3, 3..4) | # Landline
|
21
|
-
match(/^(6[01])/) >> split(2,2..3)
|
22
|
-
match(/^([67]\d)/) >> split(3,3..4)
|
22
|
+
match(/^(6[01])/) >> split(2, 2..3) | # Premium rate
|
23
|
+
match(/^([67]\d)/) >> split(3, 3..4) # Premium, personal and UAN
|
23
24
|
end
|
@@ -4,91 +4,91 @@
|
|
4
4
|
# https://www.numberingplans.com/?page=dialling&sub=areacodes
|
5
5
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=GE
|
6
6
|
|
7
|
-
ndcs_with_7_subscriber_digits = %w
|
8
|
-
ndcs_with_6_subscriber_digits = %w
|
9
|
-
341
|
10
|
-
342
|
11
|
-
344
|
12
|
-
345
|
13
|
-
346
|
14
|
-
347
|
15
|
-
348
|
16
|
-
349
|
17
|
-
350
|
18
|
-
351
|
19
|
-
352
|
20
|
-
353
|
21
|
-
354
|
22
|
-
355
|
23
|
-
356
|
24
|
-
357
|
25
|
-
358
|
26
|
-
359
|
27
|
-
360
|
28
|
-
361
|
29
|
-
362
|
30
|
-
363
|
31
|
-
364
|
32
|
-
365
|
33
|
-
366
|
34
|
-
367
|
35
|
-
368
|
36
|
-
369
|
37
|
-
370
|
38
|
-
371
|
39
|
-
372
|
40
|
-
373
|
41
|
-
374
|
42
|
-
410
|
43
|
-
411
|
44
|
-
412
|
45
|
-
413
|
46
|
-
414
|
47
|
-
415
|
48
|
-
416
|
49
|
-
417
|
50
|
-
418
|
51
|
-
419
|
52
|
-
422
|
53
|
-
423
|
54
|
-
424
|
55
|
-
425
|
56
|
-
426
|
57
|
-
427
|
58
|
-
431
|
59
|
-
432
|
60
|
-
433
|
61
|
-
434
|
62
|
-
435
|
63
|
-
436
|
64
|
-
437
|
65
|
-
439
|
66
|
-
442
|
67
|
-
443
|
68
|
-
444
|
69
|
-
445
|
70
|
-
446
|
71
|
-
447
|
72
|
-
448
|
73
|
-
472
|
74
|
-
473
|
75
|
-
474
|
76
|
-
479
|
77
|
-
491
|
78
|
-
492
|
79
|
-
493
|
80
|
-
494
|
81
|
-
495
|
82
|
-
496
|
83
|
-
497
|
84
|
-
|
7
|
+
ndcs_with_7_subscriber_digits = %w[32]
|
8
|
+
ndcs_with_6_subscriber_digits = %w[
|
9
|
+
341
|
10
|
+
342
|
11
|
+
344
|
12
|
+
345
|
13
|
+
346
|
14
|
+
347
|
15
|
+
348
|
16
|
+
349
|
17
|
+
350
|
18
|
+
351
|
19
|
+
352
|
20
|
+
353
|
21
|
+
354
|
22
|
+
355
|
23
|
+
356
|
24
|
+
357
|
25
|
+
358
|
26
|
+
359
|
27
|
+
360
|
28
|
+
361
|
29
|
+
362
|
30
|
+
363
|
31
|
+
364
|
32
|
+
365
|
33
|
+
366
|
34
|
+
367
|
35
|
+
368
|
36
|
+
369
|
37
|
+
370
|
38
|
+
371
|
39
|
+
372
|
40
|
+
373
|
41
|
+
374
|
42
|
+
410
|
43
|
+
411
|
44
|
+
412
|
45
|
+
413
|
46
|
+
414
|
47
|
+
415
|
48
|
+
416
|
49
|
+
417
|
50
|
+
418
|
51
|
+
419
|
52
|
+
422
|
53
|
+
423
|
54
|
+
424
|
55
|
+
425
|
56
|
+
426
|
57
|
+
427
|
58
|
+
431
|
59
|
+
432
|
60
|
+
433
|
61
|
+
434
|
62
|
+
435
|
63
|
+
436
|
64
|
+
437
|
65
|
+
439
|
66
|
+
442
|
67
|
+
443
|
68
|
+
444
|
69
|
+
445
|
70
|
+
446
|
71
|
+
447
|
72
|
+
448
|
73
|
+
472
|
74
|
+
473
|
75
|
+
474
|
76
|
+
479
|
77
|
+
491
|
78
|
+
492
|
79
|
+
493
|
80
|
+
494
|
81
|
+
495
|
82
|
+
496
|
83
|
+
497
|
84
|
+
]
|
85
85
|
|
86
86
|
Phony.define do
|
87
87
|
country '995',
|
88
88
|
trunk('0') |
|
89
|
-
one_of('220') >> split(3,2) |
|
90
|
-
one_of(%w
|
91
|
-
one_of(ndcs_with_6_subscriber_digits) >> split(3,3) |
|
92
|
-
one_of(ndcs_with_7_subscriber_digits) >> split(3,4) |
|
93
|
-
fixed(3) >> split(3,3)
|
94
|
-
end
|
89
|
+
one_of('220') >> split(3, 2) |
|
90
|
+
one_of(%w[514 550 551 555 557 558 568 571 574 577 578 579 591 592 593 595 596 597 598 599 770 790]) >> split(3, 3) | # mobile
|
91
|
+
one_of(ndcs_with_6_subscriber_digits) >> split(3, 3) |
|
92
|
+
one_of(ndcs_with_7_subscriber_digits) >> split(3, 4) |
|
93
|
+
fixed(3) >> split(3, 3)
|
94
|
+
end
|