phony 1.9.0 → 2.19.14
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 +7 -0
- data/README.textile +64 -112
- data/lib/phony/config.rb +91 -0
- data/lib/phony/countries/argentina.rb +355 -0
- data/lib/phony/countries/austria.rb +56 -22
- data/lib/phony/countries/bangladesh.rb +57 -0
- data/lib/phony/countries/belarus.rb +133 -0
- data/lib/phony/countries/brazil.rb +101 -95
- data/lib/phony/countries/cambodia.rb +131 -0
- data/lib/phony/countries/china.rb +13 -6
- data/lib/phony/countries/croatia.rb +23 -0
- data/lib/phony/countries/georgia.rb +94 -0
- data/lib/phony/countries/germany.rb +66 -42
- data/lib/phony/countries/guinea.rb +46 -0
- data/lib/phony/countries/india.rb +50 -0
- data/lib/phony/countries/indonesia.rb +55 -0
- data/lib/phony/countries/ireland.rb +35 -28
- data/lib/phony/countries/italy.rb +272 -166
- data/lib/phony/countries/japan.rb +468 -0
- data/lib/phony/countries/kyrgyzstan.rb +120 -0
- data/lib/phony/countries/latvia.rb +43 -0
- data/lib/phony/countries/libya.rb +116 -0
- data/lib/phony/countries/malaysia.rb +31 -7
- data/lib/phony/countries/moldova.rb +53 -0
- data/lib/phony/countries/montenegro.rb +30 -0
- data/lib/phony/countries/myanmar.rb +55 -0
- data/lib/phony/countries/namibia.rb +37 -0
- data/lib/phony/countries/nepal.rb +73 -0
- data/lib/phony/countries/netherlands.rb +17 -5
- data/lib/phony/countries/pakistan.rb +121 -0
- data/lib/phony/countries/paraguay.rb +147 -0
- data/lib/phony/countries/{russia_kazakhstan_abhasia_south_osetia.rb → russia_kazakhstan_abkhasia_south_ossetia.rb} +35 -24
- data/lib/phony/countries/saudi_arabia.rb +40 -0
- data/lib/phony/countries/serbia.rb +47 -0
- data/lib/phony/countries/somalia.rb +26 -0
- data/lib/phony/countries/south_korea.rb +19 -10
- data/lib/phony/countries/sweden.rb +58 -38
- data/lib/phony/countries/taiwan.rb +28 -0
- data/lib/phony/countries/tajikistan.rb +79 -0
- data/lib/phony/countries/turkmenistan.rb +76 -0
- data/lib/phony/countries/ukraine.rb +630 -0
- data/lib/phony/countries/united_kingdom.rb +639 -44
- data/lib/phony/countries/uruguay.rb +53 -0
- data/lib/phony/countries/vietnam.rb +133 -0
- data/lib/phony/countries/zimbabwe.rb +39 -0
- data/lib/phony/countries.rb +901 -301
- data/lib/phony/country.rb +177 -20
- data/lib/phony/country_codes.rb +119 -101
- data/lib/phony/dsl.rb +113 -68
- data/lib/phony/local_splitters/fixed.rb +25 -1
- data/lib/phony/local_splitters/regex.rb +16 -2
- data/lib/phony/national_code.rb +7 -7
- data/lib/phony/national_splitters/default.rb +35 -3
- data/lib/phony/national_splitters/dsl.rb +12 -7
- data/lib/phony/national_splitters/fixed.rb +7 -1
- data/lib/phony/national_splitters/none.rb +7 -3
- data/lib/phony/national_splitters/regex.rb +6 -0
- data/lib/phony/national_splitters/variable.rb +13 -9
- data/lib/phony/trunk_code.rb +57 -0
- data/lib/phony/vanity.rb +3 -3
- data/lib/phony.rb +239 -55
- data/spec/functional/config_spec.rb +44 -0
- data/spec/functional/plausibility_spec.rb +656 -0
- data/spec/lib/phony/countries_spec.rb +1207 -119
- data/spec/lib/phony/country_codes_spec.rb +99 -81
- data/spec/lib/phony/country_spec.rb +54 -14
- data/spec/lib/phony/dsl_spec.rb +2 -2
- data/spec/lib/phony/local_splitters/fixed_spec.rb +4 -4
- data/spec/lib/phony/local_splitters/regex_spec.rb +50 -2
- data/spec/lib/phony/national_code_spec.rb +34 -34
- data/spec/lib/phony/national_splitters/default_spec.rb +34 -0
- data/spec/lib/phony/national_splitters/fixed_spec.rb +12 -6
- data/spec/lib/phony/national_splitters/none_spec.rb +13 -3
- data/spec/lib/phony/national_splitters/regex_spec.rb +1 -1
- data/spec/lib/phony/national_splitters/variable_spec.rb +11 -5
- data/spec/lib/phony/trunk_code_spec.rb +85 -0
- data/spec/lib/phony/vanity_spec.rb +15 -19
- data/spec/lib/phony_spec.rb +59 -277
- metadata +67 -34
- data/lib/phony/validator.rb +0 -26
- data/lib/phony/validators.rb +0 -88
- data/spec/lib/phony/validations_spec.rb +0 -109
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Japan
|
|
4
|
+
# http://www.itu.int/oth/T020200006D/en
|
|
5
|
+
|
|
6
|
+
ndcs_with_8_subscriber_numbers = %w(3 6)
|
|
7
|
+
|
|
8
|
+
ndcs_with_7_subscriber_numbers = %w(
|
|
9
|
+
11
|
|
10
|
+
15
|
|
11
|
+
17
|
|
12
|
+
18
|
|
13
|
+
19
|
|
14
|
+
22
|
|
15
|
+
23
|
|
16
|
+
24
|
|
17
|
+
25
|
|
18
|
+
26
|
|
19
|
+
27
|
|
20
|
+
28
|
|
21
|
+
29
|
|
22
|
+
42
|
|
23
|
+
43
|
|
24
|
+
44
|
|
25
|
+
45
|
|
26
|
+
46
|
|
27
|
+
47
|
|
28
|
+
48
|
|
29
|
+
49
|
|
30
|
+
52
|
|
31
|
+
53
|
|
32
|
+
54
|
|
33
|
+
55
|
|
34
|
+
58
|
|
35
|
+
59
|
|
36
|
+
72
|
|
37
|
+
73
|
|
38
|
+
75
|
|
39
|
+
76
|
|
40
|
+
77
|
|
41
|
+
78
|
|
42
|
+
79
|
|
43
|
+
82
|
|
44
|
+
83
|
|
45
|
+
84
|
|
46
|
+
86
|
|
47
|
+
87
|
|
48
|
+
88
|
|
49
|
+
89
|
|
50
|
+
92
|
|
51
|
+
93
|
|
52
|
+
95
|
|
53
|
+
96
|
|
54
|
+
97
|
|
55
|
+
98
|
|
56
|
+
99
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
ndcs_with_6_subscriber_numbers = %w(
|
|
60
|
+
123
|
|
61
|
+
124
|
|
62
|
+
125
|
|
63
|
+
126
|
|
64
|
+
133
|
|
65
|
+
134
|
|
66
|
+
135
|
|
67
|
+
136
|
|
68
|
+
137
|
|
69
|
+
138
|
|
70
|
+
139
|
|
71
|
+
142
|
|
72
|
+
143
|
|
73
|
+
144
|
|
74
|
+
145
|
|
75
|
+
146
|
|
76
|
+
152
|
|
77
|
+
153
|
|
78
|
+
154
|
|
79
|
+
155
|
|
80
|
+
156
|
|
81
|
+
157
|
|
82
|
+
158
|
|
83
|
+
162
|
|
84
|
+
163
|
|
85
|
+
164
|
|
86
|
+
165
|
|
87
|
+
166
|
|
88
|
+
167
|
|
89
|
+
172
|
|
90
|
+
173
|
|
91
|
+
174
|
|
92
|
+
175
|
|
93
|
+
176
|
|
94
|
+
178
|
|
95
|
+
179
|
|
96
|
+
182
|
|
97
|
+
183
|
|
98
|
+
184
|
|
99
|
+
185
|
|
100
|
+
186
|
|
101
|
+
187
|
|
102
|
+
191
|
|
103
|
+
192
|
|
104
|
+
193
|
|
105
|
+
194
|
|
106
|
+
195
|
|
107
|
+
197
|
|
108
|
+
198
|
|
109
|
+
220
|
|
110
|
+
223
|
|
111
|
+
224
|
|
112
|
+
225
|
|
113
|
+
226
|
|
114
|
+
228
|
|
115
|
+
229
|
|
116
|
+
233
|
|
117
|
+
234
|
|
118
|
+
235
|
|
119
|
+
237
|
|
120
|
+
238
|
|
121
|
+
240
|
|
122
|
+
241
|
|
123
|
+
242
|
|
124
|
+
243
|
|
125
|
+
244
|
|
126
|
+
246
|
|
127
|
+
247
|
|
128
|
+
248
|
|
129
|
+
250
|
|
130
|
+
254
|
|
131
|
+
255
|
|
132
|
+
256
|
|
133
|
+
257
|
|
134
|
+
258
|
|
135
|
+
259
|
|
136
|
+
260
|
|
137
|
+
261
|
|
138
|
+
263
|
|
139
|
+
264
|
|
140
|
+
265
|
|
141
|
+
266
|
|
142
|
+
267
|
|
143
|
+
268
|
|
144
|
+
269
|
|
145
|
+
270
|
|
146
|
+
274
|
|
147
|
+
276
|
|
148
|
+
277
|
|
149
|
+
278
|
|
150
|
+
279
|
|
151
|
+
280
|
|
152
|
+
282
|
|
153
|
+
283
|
|
154
|
+
284
|
|
155
|
+
285
|
|
156
|
+
287
|
|
157
|
+
288
|
|
158
|
+
289
|
|
159
|
+
291
|
|
160
|
+
293
|
|
161
|
+
294
|
|
162
|
+
295
|
|
163
|
+
296
|
|
164
|
+
297
|
|
165
|
+
299
|
|
166
|
+
422
|
|
167
|
+
428
|
|
168
|
+
436
|
|
169
|
+
438
|
|
170
|
+
439
|
|
171
|
+
460
|
|
172
|
+
463
|
|
173
|
+
465
|
|
174
|
+
466
|
|
175
|
+
467
|
|
176
|
+
470
|
|
177
|
+
475
|
|
178
|
+
476
|
|
179
|
+
478
|
|
180
|
+
479
|
|
181
|
+
480
|
|
182
|
+
493
|
|
183
|
+
494
|
|
184
|
+
495
|
|
185
|
+
531
|
|
186
|
+
532
|
|
187
|
+
533
|
|
188
|
+
536
|
|
189
|
+
537
|
|
190
|
+
538
|
|
191
|
+
539
|
|
192
|
+
544
|
|
193
|
+
545
|
|
194
|
+
547
|
|
195
|
+
548
|
|
196
|
+
550
|
|
197
|
+
551
|
|
198
|
+
553
|
|
199
|
+
554
|
|
200
|
+
555
|
|
201
|
+
556
|
|
202
|
+
557
|
|
203
|
+
558
|
|
204
|
+
561
|
|
205
|
+
562
|
|
206
|
+
563
|
|
207
|
+
564
|
|
208
|
+
565
|
|
209
|
+
566
|
|
210
|
+
567
|
|
211
|
+
568
|
|
212
|
+
569
|
|
213
|
+
572
|
|
214
|
+
573
|
|
215
|
+
574
|
|
216
|
+
575
|
|
217
|
+
576
|
|
218
|
+
577
|
|
219
|
+
578
|
|
220
|
+
581
|
|
221
|
+
584
|
|
222
|
+
585
|
|
223
|
+
586
|
|
224
|
+
587
|
|
225
|
+
594
|
|
226
|
+
595
|
|
227
|
+
596
|
|
228
|
+
597
|
|
229
|
+
598
|
|
230
|
+
599
|
|
231
|
+
721
|
|
232
|
+
725
|
|
233
|
+
735
|
|
234
|
+
736
|
|
235
|
+
737
|
|
236
|
+
738
|
|
237
|
+
739
|
|
238
|
+
740
|
|
239
|
+
742
|
|
240
|
+
743
|
|
241
|
+
744
|
|
242
|
+
745
|
|
243
|
+
746
|
|
244
|
+
747
|
|
245
|
+
748
|
|
246
|
+
749
|
|
247
|
+
761
|
|
248
|
+
763
|
|
249
|
+
765
|
|
250
|
+
766
|
|
251
|
+
767
|
|
252
|
+
768
|
|
253
|
+
770
|
|
254
|
+
771
|
|
255
|
+
772
|
|
256
|
+
773
|
|
257
|
+
774
|
|
258
|
+
776
|
|
259
|
+
778
|
|
260
|
+
779
|
|
261
|
+
790
|
|
262
|
+
791
|
|
263
|
+
794
|
|
264
|
+
795
|
|
265
|
+
796
|
|
266
|
+
797
|
|
267
|
+
798
|
|
268
|
+
799
|
|
269
|
+
820
|
|
270
|
+
823
|
|
271
|
+
824
|
|
272
|
+
826
|
|
273
|
+
827
|
|
274
|
+
829
|
|
275
|
+
833
|
|
276
|
+
834
|
|
277
|
+
835
|
|
278
|
+
836
|
|
279
|
+
837
|
|
280
|
+
838
|
|
281
|
+
845
|
|
282
|
+
846
|
|
283
|
+
847
|
|
284
|
+
848
|
|
285
|
+
852
|
|
286
|
+
853
|
|
287
|
+
854
|
|
288
|
+
855
|
|
289
|
+
856
|
|
290
|
+
857
|
|
291
|
+
858
|
|
292
|
+
859
|
|
293
|
+
863
|
|
294
|
+
865
|
|
295
|
+
866
|
|
296
|
+
867
|
|
297
|
+
868
|
|
298
|
+
869
|
|
299
|
+
875
|
|
300
|
+
877
|
|
301
|
+
879
|
|
302
|
+
880
|
|
303
|
+
883
|
|
304
|
+
884
|
|
305
|
+
885
|
|
306
|
+
887
|
|
307
|
+
889
|
|
308
|
+
892
|
|
309
|
+
893
|
|
310
|
+
894
|
|
311
|
+
895
|
|
312
|
+
896
|
|
313
|
+
897
|
|
314
|
+
898
|
|
315
|
+
920
|
|
316
|
+
930
|
|
317
|
+
940
|
|
318
|
+
942
|
|
319
|
+
943
|
|
320
|
+
944
|
|
321
|
+
946
|
|
322
|
+
947
|
|
323
|
+
948
|
|
324
|
+
949
|
|
325
|
+
950
|
|
326
|
+
952
|
|
327
|
+
954
|
|
328
|
+
955
|
|
329
|
+
956
|
|
330
|
+
957
|
|
331
|
+
959
|
|
332
|
+
964
|
|
333
|
+
965
|
|
334
|
+
966
|
|
335
|
+
967
|
|
336
|
+
968
|
|
337
|
+
969
|
|
338
|
+
972
|
|
339
|
+
973
|
|
340
|
+
974
|
|
341
|
+
977
|
|
342
|
+
978
|
|
343
|
+
979
|
|
344
|
+
980
|
|
345
|
+
982
|
|
346
|
+
983
|
|
347
|
+
984
|
|
348
|
+
985
|
|
349
|
+
986
|
|
350
|
+
987
|
|
351
|
+
993
|
|
352
|
+
994
|
|
353
|
+
995
|
|
354
|
+
996
|
|
355
|
+
997
|
|
356
|
+
)
|
|
357
|
+
|
|
358
|
+
ndcs_with_5_subscriber_numbers = %w(
|
|
359
|
+
1267
|
|
360
|
+
1372
|
|
361
|
+
1374
|
|
362
|
+
1377
|
|
363
|
+
1392
|
|
364
|
+
1397
|
|
365
|
+
1398
|
|
366
|
+
1456
|
|
367
|
+
1457
|
|
368
|
+
1466
|
|
369
|
+
1547
|
|
370
|
+
1558
|
|
371
|
+
1564
|
|
372
|
+
1586
|
|
373
|
+
1587
|
|
374
|
+
1632
|
|
375
|
+
1634
|
|
376
|
+
1635
|
|
377
|
+
1648
|
|
378
|
+
1654
|
|
379
|
+
1655
|
|
380
|
+
1656
|
|
381
|
+
1658
|
|
382
|
+
4992
|
|
383
|
+
4994
|
|
384
|
+
4996
|
|
385
|
+
4998
|
|
386
|
+
5769
|
|
387
|
+
5979
|
|
388
|
+
7468
|
|
389
|
+
8387
|
|
390
|
+
8388
|
|
391
|
+
8396
|
|
392
|
+
8477
|
|
393
|
+
8512
|
|
394
|
+
8514
|
|
395
|
+
9496
|
|
396
|
+
9802
|
|
397
|
+
9912
|
|
398
|
+
9913
|
|
399
|
+
9969
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
Phony.define do
|
|
403
|
+
country '81',
|
|
404
|
+
trunk('0', normalize: true, format: true, split: true) |
|
|
405
|
+
one_of(%w(20 50 60 70 90)) >> split(4,4) | # mobile, VoIP telephony
|
|
406
|
+
match(/\A(597)9[0178]\d+\z/) >> split(2,4) |
|
|
407
|
+
one_of(ndcs_with_5_subscriber_numbers) >> split(1,4) |
|
|
408
|
+
match(/\A(4)70[019]\d+\z/) >> split(4,4) |
|
|
409
|
+
match(/\A(4)71\d+\z/) >> split(4,4) |
|
|
410
|
+
match(/\A(4)20\d+\z/) >> split(4,4) |
|
|
411
|
+
match(/\A(4)29[02-69]\d+\z/) >> split(4,4) |
|
|
412
|
+
match(/\A(15)4[018]\d+\z/) >> split(3,4) |
|
|
413
|
+
match(/\A(22)3[014-9]\d+\z/) >> split(3,4) |
|
|
414
|
+
match(/\A(25)[04][01]\d+\z/) >> split(3,4) |
|
|
415
|
+
match(/\A(25)5[0-69]\d+\z/) >> split(3,4) |
|
|
416
|
+
match(/\A(25)[68][01]\d+\z/) >> split(3,4) |
|
|
417
|
+
match(/\A(25)7[015-9]\d+\z/) >> split(3,4) |
|
|
418
|
+
match(/\A(25)917\d+\z/) >> split(3,4) |
|
|
419
|
+
match(/\A(25)999\d+\z/) >> split(3,4) |
|
|
420
|
+
match(/\A(26)4[016-9]\d+\z/) >> split(3,4) |
|
|
421
|
+
match(/\A(28)3[0134]\d+\z/) >> split(3,4) |
|
|
422
|
+
match(/\A(28)9[0-5]\d+\z/) >> split(3,4) |
|
|
423
|
+
match(/\A(29)17\d+\z/) >> split(3,4) |
|
|
424
|
+
match(/\A(29)3[015-9]\d+\z/) >> split(3,4) |
|
|
425
|
+
match(/\A(42)21\d+\z/) >> split(3,4) |
|
|
426
|
+
match(/\A(42)8[01456]\d+\z/) >> split(3,4) |
|
|
427
|
+
match(/\A(47)5[019]\d+\z/) >> split(3,4) |
|
|
428
|
+
match(/\A(47)9[019]\d+\z/) >> split(3,4) |
|
|
429
|
+
match(/\A(59)8[019]\d+\z/) >> split(3,4) |
|
|
430
|
+
match(/\A(59)9[01]\d+\z/) >> split(3,4) |
|
|
431
|
+
match(/\A(79)4[0-59]\d+\z/) >> split(3,4) |
|
|
432
|
+
match(/\A(79)5[01569]\d+\z/) >> split(3,4) |
|
|
433
|
+
match(/\A(79)6[0167]\d+\z/) >> split(3,4) |
|
|
434
|
+
match(/\A(82)4[0-39]\d+\z/) >> split(3,4) |
|
|
435
|
+
match(/\A(82)9[019]\d+\z/) >> split(3,4) |
|
|
436
|
+
match(/\A(82)92[1-9]\d+\z/) >> split(3,4) |
|
|
437
|
+
match(/\A(82)94[1-3]\d+\z/) >> split(3,4) |
|
|
438
|
+
match(/\A(82)96[0-47-9]\d+\z/) >> split(3,4) |
|
|
439
|
+
match(/\A(82)965[01346-9]\d+\z/) >> split(3,4) |
|
|
440
|
+
match(/\A(82)966[1-9]\d+\z/) >> split(3,4) |
|
|
441
|
+
match(/\A(83)76[6-8]\d+\z/) >> split(3,4) |
|
|
442
|
+
match(/\A(83)7[01789]\d+\z/) >> split(3,4) |
|
|
443
|
+
match(/\A(83)8[01]\d+\z/) >> split(3,4) |
|
|
444
|
+
match(/\A(86)36[23]\d+\z/) >> split(3,4) |
|
|
445
|
+
match(/\A(86)5[0-389]\d+\z/) >> split(3,4) |
|
|
446
|
+
match(/\A(86)55[23]\d+\z/) >> split(3,4) |
|
|
447
|
+
match(/\A(86)[01]\d+\z/) >> split(3,4) |
|
|
448
|
+
match(/\A(86)9[178]\d+\z/) >> split(3,4) |
|
|
449
|
+
match(/\A(86)72\d+\z/) >> split(3,4) |
|
|
450
|
+
match(/\A(86)8[019]\d+\z/) >> split(3,4) |
|
|
451
|
+
match(/\A(86)9[0145]\d+\z/) >> split(3,4) |
|
|
452
|
+
match(/\A(86)99[014-9]\d+\z/) >> split(3,4) |
|
|
453
|
+
match(/\A(99)331\d+\z/) >> split(3,4) |
|
|
454
|
+
match(/\A(99)34[357]\d+\z/) >> split(3,4) |
|
|
455
|
+
match(/\A(99)4[0178]\d+\z/) >> split(3,4) |
|
|
456
|
+
one_of(ndcs_with_6_subscriber_numbers) >> split(2,4) |
|
|
457
|
+
one_of(%w(120)) >> split(3,3) | # freephone
|
|
458
|
+
one_of(%w(800)) >> split(3,4) | # freephone
|
|
459
|
+
one_of(%w(180 570)) >> split(3,3) | # Tele-gong/Tele-dome, Navi-dial
|
|
460
|
+
one_of(%w(170 990)) >> split(2,4) | # Dengon-dial, Dial Q2 (discontinued)
|
|
461
|
+
one_of(%w(80)) >> split(4,4) | # mobile
|
|
462
|
+
one_of(ndcs_with_7_subscriber_numbers) >> split(3,4) |
|
|
463
|
+
one_of(ndcs_with_8_subscriber_numbers) >> split(4,4) |
|
|
464
|
+
# TODO: 91(NDC) N(S)N length: 5-13 - Non-geographic number (Direct subscriber telephone service (legacy))
|
|
465
|
+
fixed(2) >> split(4,4),
|
|
466
|
+
local_space: :-,
|
|
467
|
+
space: :-
|
|
468
|
+
end
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Kyrgyz Republic
|
|
4
|
+
# https://www.numberingplans.com/?page=dialling&sub=areacodes
|
|
5
|
+
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=KG
|
|
6
|
+
|
|
7
|
+
ndcs_with_6_subscriber_digits = %w(312 315)
|
|
8
|
+
|
|
9
|
+
ndcs_with_5_subscriber_digits = %w(
|
|
10
|
+
3131
|
|
11
|
+
3132
|
|
12
|
+
3133
|
|
13
|
+
3134
|
|
14
|
+
3135
|
|
15
|
+
3137
|
|
16
|
+
3138
|
|
17
|
+
3147
|
|
18
|
+
3161
|
|
19
|
+
3162
|
|
20
|
+
3163
|
|
21
|
+
3164
|
|
22
|
+
3165
|
|
23
|
+
3166
|
|
24
|
+
3167
|
|
25
|
+
3168
|
|
26
|
+
3222
|
|
27
|
+
3230
|
|
28
|
+
3231
|
|
29
|
+
3232
|
|
30
|
+
3233
|
|
31
|
+
3234
|
|
32
|
+
3237
|
|
33
|
+
3239
|
|
34
|
+
3261
|
|
35
|
+
3262
|
|
36
|
+
3263
|
|
37
|
+
3264
|
|
38
|
+
3265
|
|
39
|
+
3266
|
|
40
|
+
3267
|
|
41
|
+
3422
|
|
42
|
+
3456
|
|
43
|
+
3457
|
|
44
|
+
3458
|
|
45
|
+
3459
|
|
46
|
+
3461
|
|
47
|
+
3462
|
|
48
|
+
3463
|
|
49
|
+
3464
|
|
50
|
+
3522
|
|
51
|
+
3534
|
|
52
|
+
3535
|
|
53
|
+
3536
|
|
54
|
+
3537
|
|
55
|
+
3559
|
|
56
|
+
3561
|
|
57
|
+
3562
|
|
58
|
+
3563
|
|
59
|
+
3564
|
|
60
|
+
3565
|
|
61
|
+
3622
|
|
62
|
+
3653
|
|
63
|
+
3655
|
|
64
|
+
3656
|
|
65
|
+
3657
|
|
66
|
+
3661
|
|
67
|
+
3662
|
|
68
|
+
3663
|
|
69
|
+
3722
|
|
70
|
+
3734
|
|
71
|
+
3736
|
|
72
|
+
3738
|
|
73
|
+
3741
|
|
74
|
+
3742
|
|
75
|
+
3743
|
|
76
|
+
3744
|
|
77
|
+
3745
|
|
78
|
+
3746
|
|
79
|
+
3747
|
|
80
|
+
3748
|
|
81
|
+
3759
|
|
82
|
+
3761
|
|
83
|
+
3762
|
|
84
|
+
3763
|
|
85
|
+
3764
|
|
86
|
+
3765
|
|
87
|
+
3766
|
|
88
|
+
3767
|
|
89
|
+
3768
|
|
90
|
+
3769
|
|
91
|
+
3775
|
|
92
|
+
3776
|
|
93
|
+
3777
|
|
94
|
+
3922
|
|
95
|
+
3941
|
|
96
|
+
3942
|
|
97
|
+
3943
|
|
98
|
+
3944
|
|
99
|
+
3945
|
|
100
|
+
3946
|
|
101
|
+
3947
|
|
102
|
+
3961
|
|
103
|
+
3962
|
|
104
|
+
3963
|
|
105
|
+
3964
|
|
106
|
+
3965
|
|
107
|
+
3966
|
|
108
|
+
3967
|
|
109
|
+
3968
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
Phony.define do
|
|
113
|
+
country '996',
|
|
114
|
+
one_of(ndcs_with_5_subscriber_digits) >> split(3,2) |
|
|
115
|
+
one_of(ndcs_with_6_subscriber_digits) >> split(3,3) |
|
|
116
|
+
one_of(%w(800)) >> split(3,3) | # freephone
|
|
117
|
+
one_of(%w(50 51 54 55 56 57 58 60 61 62 70 77)) >> split(3,4) | # mobile
|
|
118
|
+
one_of(%w(52)) >> split(3,4) | # satellite
|
|
119
|
+
fixed(3) >> split(3,3)
|
|
120
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Latvia
|
|
4
|
+
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=LV
|
|
5
|
+
# https://www.numberingplans.com/?page=dialling&sub=areacodes
|
|
6
|
+
|
|
7
|
+
ndcs_with_5_subscriber_numbers = %w(
|
|
8
|
+
630
|
|
9
|
+
631
|
|
10
|
+
632
|
|
11
|
+
633
|
|
12
|
+
634
|
|
13
|
+
636
|
|
14
|
+
637
|
|
15
|
+
638
|
|
16
|
+
639
|
|
17
|
+
640
|
|
18
|
+
641
|
|
19
|
+
642
|
|
20
|
+
643
|
|
21
|
+
644
|
|
22
|
+
645
|
|
23
|
+
646
|
|
24
|
+
647
|
|
25
|
+
648
|
|
26
|
+
650
|
|
27
|
+
651
|
|
28
|
+
652
|
|
29
|
+
653
|
|
30
|
+
654
|
|
31
|
+
656
|
|
32
|
+
657
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
ndcs_with_6_subscriber_numbers = %w(67)
|
|
36
|
+
|
|
37
|
+
Phony.define do
|
|
38
|
+
country '371',
|
|
39
|
+
trunk('8', :normalize => false) |
|
|
40
|
+
one_of(ndcs_with_5_subscriber_numbers) >> split(3,2) |
|
|
41
|
+
one_of(ndcs_with_6_subscriber_numbers) >> split(3,3) |
|
|
42
|
+
fixed(3) >> split(3,2)
|
|
43
|
+
end
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Lybia, https://www.numberingplans.com/?page=dialling&sub=areacodes
|
|
4
|
+
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=LY
|
|
5
|
+
|
|
6
|
+
ndcs_with_7_subscriber_numbers = %w(21)
|
|
7
|
+
|
|
8
|
+
ndcs_with_6_subscriber_numbers = %w(
|
|
9
|
+
22
|
|
10
|
+
23
|
|
11
|
+
24
|
|
12
|
+
25
|
|
13
|
+
26
|
|
14
|
+
31
|
|
15
|
+
41
|
|
16
|
+
47
|
|
17
|
+
51
|
|
18
|
+
54
|
|
19
|
+
57
|
|
20
|
+
61
|
|
21
|
+
63
|
|
22
|
+
67
|
|
23
|
+
71
|
|
24
|
+
73
|
|
25
|
+
81
|
|
26
|
+
82
|
|
27
|
+
84
|
|
28
|
+
87
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
ndcs_with_5_subscriber_numbers = %w(
|
|
32
|
+
205
|
|
33
|
+
206
|
|
34
|
+
224
|
|
35
|
+
252
|
|
36
|
+
271
|
|
37
|
+
272
|
|
38
|
+
274
|
|
39
|
+
275
|
|
40
|
+
277
|
|
41
|
+
279
|
|
42
|
+
281
|
|
43
|
+
282
|
|
44
|
+
284
|
|
45
|
+
322
|
|
46
|
+
323
|
|
47
|
+
325
|
|
48
|
+
326
|
|
49
|
+
421
|
|
50
|
+
422
|
|
51
|
+
423
|
|
52
|
+
425
|
|
53
|
+
427
|
|
54
|
+
452
|
|
55
|
+
453
|
|
56
|
+
454
|
|
57
|
+
481
|
|
58
|
+
482
|
|
59
|
+
484
|
|
60
|
+
521
|
|
61
|
+
522
|
|
62
|
+
523
|
|
63
|
+
524
|
|
64
|
+
526
|
|
65
|
+
529
|
|
66
|
+
551
|
|
67
|
+
553
|
|
68
|
+
554
|
|
69
|
+
555
|
|
70
|
+
581
|
|
71
|
+
582
|
|
72
|
+
583
|
|
73
|
+
584
|
|
74
|
+
623
|
|
75
|
+
624
|
|
76
|
+
625
|
|
77
|
+
626
|
|
78
|
+
627
|
|
79
|
+
628
|
|
80
|
+
629
|
|
81
|
+
652
|
|
82
|
+
653
|
|
83
|
+
654
|
|
84
|
+
655
|
|
85
|
+
657
|
|
86
|
+
681
|
|
87
|
+
682
|
|
88
|
+
683
|
|
89
|
+
684
|
|
90
|
+
685
|
|
91
|
+
721
|
|
92
|
+
723
|
|
93
|
+
724
|
|
94
|
+
725
|
|
95
|
+
726
|
|
96
|
+
727
|
|
97
|
+
729
|
|
98
|
+
731
|
|
99
|
+
732
|
|
100
|
+
733
|
|
101
|
+
734
|
|
102
|
+
821
|
|
103
|
+
851
|
|
104
|
+
852
|
|
105
|
+
854
|
|
106
|
+
884
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
Phony.define do
|
|
110
|
+
country '218',
|
|
111
|
+
one_of(ndcs_with_5_subscriber_numbers) >> split(3,2) |
|
|
112
|
+
one_of(ndcs_with_6_subscriber_numbers) >> split(3,3) |
|
|
113
|
+
one_of(ndcs_with_7_subscriber_numbers) >> split(4,3) |
|
|
114
|
+
one_of(%w(91 92 94 95)) >> split(4,3) | # mobile
|
|
115
|
+
fixed(2) >> split(3,3)
|
|
116
|
+
end
|