phony 2.4.3 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzAxMjNlYzdlNzVhNjJiN2ExMTFhM2E4MjllN2Y3NThkNjY4NjMxZA==
4
+ OTY1NzU0ODM4NDg2NDg3MzU3NTFiZDM3MDIxMGIwYzlmMmYwMzgxOQ==
5
5
  data.tar.gz: !binary |-
6
- MTViNjMxNTNlY2I1ZTlmZWQ3YWZlNDZmY2JiZDM2NzJmMGUzM2EyYw==
6
+ NWZkYzZjNTM2OTY4MTdlNjQ4Y2UzYzZkNTM2ZjY0ODUyMjdjZjFiNA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZGE2MDVkYWQ3MTM2MjNkMjYzMjQxYmUzYzIzODc4YTRmODBiNTY1OGRjOWIx
10
- ZjRiOTIwZjBjZjdmM2I1YzE3YzUyN2EwODMwZDk4N2QwNGU5NDlkNWJiM2Zj
11
- NTk4NzY0NDgyYjU0N2ExNDg1YTQ5ZDFlZTVlZTQ5NjU3YTQ5MWI=
9
+ MzkyM2I2MDAwNmQ0ZGMyZTg1MDIzNTM0NjE2ZjYwNjI0YmExNTQ0YzRmYmRk
10
+ MWVkMTA4OTdlMDlmYjVhMjJiNDY1N2MyY2QxYWRjZmUyNTY1NDdlNjE1NDMx
11
+ NGY4YTVkNzZmZGQ1ODc1ZjE1Mzc1Y2RhNTBlZDlmMmQ4YThmZTg=
12
12
  data.tar.gz: !binary |-
13
- NDMyNDEyYzQzZDg0ODUwZTAyYjMyN2NlMDkwZGRhZWUzMjg2NTk5NTI4ODky
14
- NjM1N2I5YmMzMDAyOTI4YThiZDc0ZTAwNTdkNWM1ZjIxYTVjZTA4ZmU2NWZl
15
- ZDdkMDEyZjgwYWI2ZDBhOGY1MDFkNGViYjFhZjUyYThjNGQ5MDQ=
13
+ YjJkMDAzODRlMDk2OWQyOWE0ODI4OGY3ZTYxZWEwZGQwNjU5NTRjNWIzZTMw
14
+ NTliYzc2MjFlOTA2NWVmMDA0YjRjZGE5NzgwZThhZDNkMmJkNGExNDljMGFh
15
+ MjU3NTE1MGI2MTNlMGQ4YTk5MzcwZDc0MDJlZGEyYjBkNmU5YTg=
@@ -72,14 +72,17 @@ Phony.define do
72
72
  #
73
73
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Belgium
74
74
  #
75
- country '32', match(/^(70|800|90\d)\d+$/) >> split(3,3) | # Service
75
+ country '32', trunk('0') |
76
+ match(/^(70|800|90\d)\d+$/) >> split(3,3) | # Service
76
77
  match(/^(4[789]\d)\d{6}$/) >> split(6) | # Mobile
77
78
  one_of('2','3','4','9') >> split(3,2,2) | # Short NDCs
78
79
  fixed(2) >> split(2,2,2) # 2-digit NDCs
79
80
 
80
81
  # France.
81
82
  #
82
- country '33', fixed(1) >> split(2,2,2,2) # :service? => /^8.*$/, :mobile? => /^[67].*$/
83
+ country '33',
84
+ trunk('0') |
85
+ fixed(1) >> split(2,2,2,2) # :service? => /^8.*$/, :mobile? => /^[67].*$/
83
86
 
84
87
  # Spain.
85
88
  #
@@ -105,6 +108,7 @@ Phony.define do
105
108
  # Romania.
106
109
  #
107
110
  country '40',
111
+ trunk('0') |
108
112
  match(/^(112|800|90[036])\d+$/) >> split(3,3) | # Service
109
113
  match(/^(7[1-8])\d+$/) >> split(3,4) | # Mobile
110
114
  one_of('21', '31') >> split(3,4) | # Bucureşti
@@ -182,62 +186,66 @@ Phony.define do
182
186
  # Chile.
183
187
  #
184
188
  country '56',
185
- match(/^(13[0-79]|14[79])\d+$/) >> split(3,3) | # Service
186
- one_of('2', '9') >> split(8) | # Santiago, Mobile
187
- fixed(2) >> split(8) # 2-digit NDCs
189
+ match(/^(13[0-79]|14[79])\d+$/) >> split(3,3) | # Service
190
+ one_of('2', '9') >> split(8) | # Santiago, Mobile
191
+ fixed(2) >> split(8) # 2-digit NDCs
188
192
 
189
193
  # Colombia.
190
194
  # http://www.itu.int/oth/T020200002C/en
191
195
  country '57',
192
- match(/\A(3\d\d)\d+\z/) >> split(3,4) | # mobile (300 310 311 312 313 315 316)
193
- fixed(1) >> split(3,4)
196
+ match(/\A(3\d\d)\d+\z/) >> split(3,4) | # mobile (300 310 311 312 313 315 316)
197
+ fixed(1) >> split(3,4)
194
198
 
195
199
  # Venezuela (Bolivarian Republic of)
196
200
  #
197
201
  country '58',
198
- fixed(3) >> split(7)
202
+ fixed(3) >> split(7)
199
203
 
200
204
  # country '60' # Malaysia, see special file.
201
205
 
202
206
  # Australia.
203
207
  #
204
208
  country '61',
205
- match(/^(4\d\d)\d+$/) >> split(3,3) | # Mobile
206
- fixed(1) >> split(4,4) # Rest
209
+ trunk('0') |
210
+ match(/^(4\d\d)\d+$/) >> split(3,3) | # Mobile
211
+ fixed(1) >> split(4,4) # Rest
207
212
 
208
213
  # country '62' # Indonesia (Republic of), see special file
209
214
 
210
- # TODO Philippines (Republic of the)
215
+ # Philippines (Republic of the)
211
216
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=PH
212
217
  country '63',
213
- # 7/10 digits for area code '2'.
214
- match(/\A(2)\d{10}\z/) >> split(10) |
215
- one_of('2') >> split(7) |
216
- # mobile
217
- match(/\A(9\d\d)\d{7}\z/) >> split(7) |
218
- match(/\A(9\d\d)\d+\z/) >> split(6) |
219
- #
220
- fixed(2) >> split(7)
218
+ trunk('0') |
219
+ # 7/10 digits for area code '2'.
220
+ match(/\A(2)\d{10}\z/) >> split(10) |
221
+ one_of('2') >> split(7) |
222
+ # mobile
223
+ match(/\A(9\d\d)\d{7}\z/) >> split(7) |
224
+ match(/\A(9\d\d)\d+\z/) >> split(6) |
225
+ #
226
+ fixed(2) >> split(7)
221
227
 
222
228
  # New Zealand.
223
229
  #
224
230
  country '64',
225
- match(/^(2\d)\d{7}$/) >> split(3,4) | # Mobile
226
- match(/^(2\d)\d{6}$/) >> split(3,3) |
227
- match(/^(2\d)\d{8}$/) >> split(2,3,3) |
228
- fixed(1) >> split(3,4) # Rest
231
+ trunk('0') |
232
+ match(/^(2\d)\d{7}$/) >> split(3,4) | # Mobile
233
+ match(/^(2\d)\d{6}$/) >> split(3,3) |
234
+ match(/^(2\d)\d{8}$/) >> split(2,3,3) |
235
+ fixed(1) >> split(3,4) # Rest
229
236
 
230
237
  # Singapore (Republic of).
231
238
  #
232
239
  country '65',
233
- none >> split(4,4) # TODO Short Codes.
240
+ none >> split(4,4) # TODO Short Codes.
234
241
 
235
242
  # Thailand.
236
243
  #
237
244
  country '66',
238
- match(/\A(8\d\d)\d+\z/) >> split(3,3) | # mobile
239
- one_of('2') >> split(3,4) | # Bangkok
240
- fixed(2) >> split(3,3) # Rest
245
+ trunk('0') |
246
+ match(/\A(8\d\d)\d+\z/) >> split(3,3) | # mobile
247
+ one_of('2') >> split(3,4) | # Bangkok
248
+ fixed(2) >> split(3,3) # Rest
241
249
 
242
250
  # country '81' # Japan, see special file.
243
251
 
@@ -250,7 +258,8 @@ Phony.define do
250
258
  # Turkey.
251
259
  #
252
260
  country '90',
253
- fixed(3) >> split(3,4) # Wiki says 7, but the examples say 3, 4.
261
+ trunk('0') |
262
+ fixed(3) >> split(3,4) # Wiki says 7, but the examples say 3, 4.
254
263
 
255
264
  # country '91' # India (Republic of) see special file
256
265
 
@@ -263,20 +272,21 @@ Phony.define do
263
272
  country '93', fixed(2) >> split(7) # Note: the document says 6, but the examples use 7.
264
273
 
265
274
  country '94', # TODO Sri Lanka (Democratic Socialist Republic of)
266
- fixed(2) >> split(3,2,2)
275
+ fixed(2) >> split(3,2,2)
267
276
 
268
- country '95', fixed(2) >> split(3,2,2) # TODO Myanmar (Union of)
277
+ country '95', trunk('0') | fixed(2) >> split(3,2,2) # TODO Myanmar (Union of)
269
278
 
270
279
  country '98', # Iran (Islamic Republic of)
271
- one_of('21') >> split(4,4) | # Teheran
272
- fixed(3) >> split(3,4)
280
+ one_of('21') >> split(4,4) | # Teheran
281
+ fixed(3) >> split(3,4)
273
282
 
274
283
  country '210', todo # -
275
284
  country '211', fixed(3) >> split(3,3) # South Sudan, http://www.wtng.info/wtng-211-ss.html
276
285
 
277
286
  country '212', # Morocco
278
- one_of('6') >> split(2,2,2,2) | # mobile
279
- fixed(2) >> split(4,3)
287
+ trunk('0') |
288
+ one_of('6') >> split(2,2,2,2) | # mobile
289
+ fixed(2) >> split(4,3)
280
290
 
281
291
  country '213', fixed(2) >> split(3,4) # Algeria
282
292
  country '214', todo # -
@@ -304,12 +314,12 @@ Phony.define do
304
314
  # Liberia
305
315
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=LR
306
316
  country '231',
307
- none >> matched_split(
308
- /\A[23]\d+\z/ => [4,4], # LIBTELCO, TEMAS
309
- /\A[4568]\d+\z/ => [4,3], # mobile Lonestar, Libercell, Comium Liberia Inc.
310
- /\A7\d+\z/ => [4,4], # mobile Cellcom
311
- /\A9\d+\z/ => [4,4], # premium rate Telelinks International SAL, Interactive Media Corporation
312
- )
317
+ none >> matched_split(
318
+ /\A[23]\d+\z/ => [4,4], # LIBTELCO, TEMAS
319
+ /\A[4568]\d+\z/ => [4,3], # mobile Lonestar, Libercell, Comium Liberia Inc.
320
+ /\A7\d+\z/ => [4,4], # mobile Cellcom
321
+ /\A9\d+\z/ => [4,4], # premium rate Telelinks International SAL, Interactive Media Corporation
322
+ )
313
323
 
314
324
  country '232', fixed(2) >> split(3, 3) # Sierra Leone http://www.wtng.info/wtng-232-sl.html
315
325
 
@@ -322,11 +332,11 @@ Phony.define do
322
332
  # Nigeria
323
333
  # Wikipedia says 3 4 split, many local number with no splitting
324
334
  country '234',
325
- one_of('1', '2', '9') >> split(3,4) | # Lagos, Ibadan and Abuja
326
- match(/^(702\d)\d+$/) >> split(3,4) | # Mobile
327
- match(/^(70[3-9])\d+$/) >> split(3,4) | # Mobile
328
- match(/^(8[01]\d)\d+$/) >> split(3,4) | # Mobile
329
- fixed(2) >> split(3,4) # 2-digit NDC
335
+ one_of('1', '2', '9') >> split(3,4) | # Lagos, Ibadan and Abuja
336
+ match(/^(702\d)\d+$/) >> split(3,4) | # Mobile
337
+ match(/^(70[3-9])\d+$/) >> split(3,4) | # Mobile
338
+ match(/^(8[01]\d)\d+$/) >> split(3,4) | # Mobile
339
+ fixed(2) >> split(3,4) # 2-digit NDC
330
340
 
331
341
  country '235', none >> split(4,4) # Chad http://www.wtng.info/wtng-235-td.html
332
342
  country '236', none >> split(4,4) # Central African Republic http://www.wtng.info/wtng-236-cf.html
@@ -345,16 +355,17 @@ Phony.define do
345
355
  country '247', none >> split(4) # Ascension
346
356
 
347
357
  country '248', # Seychelles
348
- fixed(1) >> split(2,2,2)
358
+ fixed(1) >> split(2,2,2)
349
359
 
350
360
  country '249', fixed(2) >> split(3,4) # Sudan
351
361
 
352
362
  # Rwanda
353
363
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Rwanda
354
364
  country '250',
355
- one_of('25') >> split(7) | # Geographic, fixed
356
- match(/^(7[238])/) >> split(7) | # Non-geographic, mobile
357
- one_of('06') >> split(6) # Satellite
365
+ trunk('0') |
366
+ one_of('25') >> split(7) | # Geographic, fixed
367
+ match(/^(7[238])/) >> split(7) | # Non-geographic, mobile
368
+ one_of('06') >> split(6) # Satellite
358
369
 
359
370
  country '251', fixed(2) >> split(3, 4) # Ethiopia http://www.wtng.info/wtng-251-et.html
360
371
 
@@ -372,32 +383,33 @@ Phony.define do
372
383
  # Tanzania.
373
384
  #
374
385
  country '255',
375
- match(/^([89]\d\d)/) >> split(3,3) | # Special/Premium.
376
- one_of('112', '118') >> split(3,3) | # Short Codes.
377
- fixed(2) >> split(3,4) # Geographic.
386
+ trunk('0') |
387
+ match(/^([89]\d\d)/) >> split(3,3) | # Special/Premium.
388
+ one_of('112', '118') >> split(3,3) | # Short Codes.
389
+ fixed(2) >> split(3,4) # Geographic.
378
390
 
379
391
  # Uganda.
380
392
  #
381
393
  country '256',
382
- match(/^(46[45]|4[78]\d)/) >> split(6) | # Geo 1.
383
- fixed(2) >> split(7) # Geo 2.
394
+ match(/^(46[45]|4[78]\d)/) >> split(6) | # Geo 1.
395
+ fixed(2) >> split(7) # Geo 2.
384
396
 
385
397
  country '257', none >> split(4,4) # Burundi http://www.wtng.info/wtng-257-bi.html
386
398
 
387
399
  # Mozambique, https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=MZ
388
400
  country '258',
389
- one_of('600') >> split(3,3) | # audiotext
390
- one_of('610') >> split(3,3) | # ISP
391
- one_of('800') >> split(3,3) | # freephone
392
- one_of('801') >> split(3,3) | # local rate
393
- one_of('802') >> split(3,3) | # national rate
394
- one_of(%w(251 252 271 272 281 282 293)) >> split(3,2) |
395
- one_of(%w(21 23 24 26)) >> split(3,3) |
396
- one_of(%w(82 84 86)) >> split(4,3) | # mobile
397
- one_of('89') >> split(4,3) | # satellite GMPCS
398
- one_of('7') >> split(4,4) | # universal access
399
- one_of('9') >> split(4,4) | # premium rate
400
- fixed(2) >> split(3,3)
401
+ one_of('600') >> split(3,3) | # audiotext
402
+ one_of('610') >> split(3,3) | # ISP
403
+ one_of('800') >> split(3,3) | # freephone
404
+ one_of('801') >> split(3,3) | # local rate
405
+ one_of('802') >> split(3,3) | # national rate
406
+ one_of(%w(251 252 271 272 281 282 293)) >> split(3,2) |
407
+ one_of(%w(21 23 24 26)) >> split(3,3) |
408
+ one_of(%w(82 84 86)) >> split(4,3) | # mobile
409
+ one_of('89') >> split(4,3) | # satellite GMPCS
410
+ one_of('7') >> split(4,4) | # universal access
411
+ one_of('9') >> split(4,4) | # premium rate
412
+ fixed(2) >> split(3,3)
401
413
 
402
414
  country '259', todo # -
403
415
 
@@ -549,7 +561,8 @@ Phony.define do
549
561
  # country '353' # Republic of Ireland, see special file.
550
562
 
551
563
  country '354', none >> split(3,4) # Iceland
552
- country '355', one_of('4') >> split(4,3) | # Albania
564
+ country '355', trunk('0') |
565
+ one_of('4') >> split(4,3) | # Albania
553
566
  match(/\A(2[24]|3[2-5]|47|5[2-5]|6[6-9]|8[2-5])\d*\z/) >> split(3,3) |
554
567
  fixed(3) >> split(3,2)
555
568
 
@@ -562,12 +575,14 @@ Phony.define do
562
575
 
563
576
  # Cyprus
564
577
  # http://www.cytaglobal.com/cytaglobal/userfiles/NewNumberingPlan.pdf
565
- country '357', one_of('121','122','123') >> split(2,6) | # voicemail
578
+ country '357', trunk('0') |
579
+ one_of('121','122','123') >> split(2,6) | # voicemail
566
580
  fixed(2) >> split(6) # fixed & mobile
567
581
 
568
582
  # Finland
569
583
  #
570
584
  country '358',
585
+ trunk('0') |
571
586
  match(/^([6-8]00)\d+$/) >> split(3,3) | # Service
572
587
  match(/^(4\d|50)\d+$/) >> split(3,2,2) | # Mobile
573
588
  one_of('2','3','5','6','8','9') >> split(3,3) | # Short NDCs
@@ -576,17 +591,18 @@ Phony.define do
576
591
  # Bulgaria
577
592
  #
578
593
  country '359',
594
+ trunk('0') |
579
595
  fixed(2) >> split(3,2,2) # Bulgaria
580
596
 
581
597
  # Lithuania
582
598
  #
583
599
  country '370',
584
- trunk('8') |
585
- one_of('700', '800') >> split(2,3) | # Service
586
- match(/^(6\d\d)\d+$/) >> split(2,3) | # Mobile
587
- one_of('5') >> split(3,2,2) | # Vilnius
588
- one_of('37','41') >> split(2,2,2) | # Kaunas, Šiauliai
589
- fixed(3) >> split(1,2,2) # 3-digit NDCs.
600
+ trunk('8') |
601
+ one_of('700', '800') >> split(2,3) | # Service
602
+ match(/^(6\d\d)\d+$/) >> split(2,3) | # Mobile
603
+ one_of('5') >> split(3,2,2) | # Vilnius
604
+ one_of('37','41') >> split(2,2,2) | # Kaunas, Šiauliai
605
+ fixed(3) >> split(1,2,2) # 3-digit NDCs.
590
606
 
591
607
  # country '371' # Latvia, see special file
592
608
 
@@ -633,10 +649,10 @@ Phony.define do
633
649
 
634
650
  # country '385' # Croatia, see special file.
635
651
 
636
- country '386', fixed(2) >> split(3, 2, 2) # Slovenia
637
- country '387', fixed(2) >> split(3,2,2) # Bosnia and Herzegovina
638
- country '388', fixed(2) >> split(3,2,2) # Group of countries, shared code
639
- country '389', fixed(2) >> split(3,2,2) # The Former Yugoslav Republic of Macedonia
652
+ country '386', trunk('0') | fixed(2) >> split(3, 2, 2) # Slovenia
653
+ country '387', trunk('0') | fixed(2) >> split(3,2,2) # Bosnia and Herzegovina
654
+ country '388', trunk('0') | fixed(2) >> split(3,2,2) # Group of countries, shared code
655
+ country '389', trunk('0') | fixed(2) >> split(3,2,2) # The Former Yugoslav Republic of Macedonia
640
656
 
641
657
  country '420', fixed(3) >> split(3,3) # Czech Republic
642
658
 
@@ -705,7 +721,8 @@ Phony.define do
705
721
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
706
722
  country '590', fixed(3) >> split(3,3)
707
723
 
708
- country '591', fixed(1) >> split(3,4) # Bolivia (Republic of) http://www.itu.int/oth/T020200001A/en
724
+ country '591', # Bolivia (Republic of) http://www.itu.int/oth/T020200001A/en
725
+ fixed(1) >> split(3,4)
709
726
 
710
727
  # Guyana http://www.wtng.info/wtng-592-gy.html
711
728
  # https://www.numberingplans.com
@@ -1009,9 +1026,10 @@ Phony.define do
1009
1026
 
1010
1027
  # Israel (State of) (also works for numbers in Palestinian territories)
1011
1028
  country '972',
1012
- one_of('1') >> split(3,3,3) | # special numbers
1013
- one_of('2', '3', '4', '8', '9') >> split(3,4) | # 1 digit ndc
1014
- match(/^(5[023456789]|7[23467])\d+$/) >> split(3,4) # 2 digit ndc
1029
+ trunk('0') |
1030
+ one_of('1') >> split(3,3,3) | # special numbers
1031
+ one_of('2', '3', '4', '8', '9') >> split(3,4) | # 1 digit ndc
1032
+ match(/^(5[023456789]|7[23467])\d+$/) >> split(3,4) # 2 digit ndc
1015
1033
 
1016
1034
  country '973', none >> split(4,4..4) # Bahrain (Kingdom of) http://www.itu.int/oth/T0202000011/en
1017
1035
 
@@ -114,6 +114,7 @@ ndcs_with_7_subscriber_digits = %w(17 25 29 33 44)
114
114
 
115
115
  Phony.define do
116
116
  country '375',
117
+ trunk('8') |
117
118
  one_of(ndcs_with_5_subscriber_digits) >> split(5) |
118
119
  one_of(ndcs_with_6_subscriber_digits) >> split(6) |
119
120
  one_of(ndcs_with_7_subscriber_digits) >> split(7) |
@@ -95,10 +95,11 @@ special_numbers_3_4 = %w{ 0800 }
95
95
  special_numbers_4 = %w{ 3003 4004 4020 }
96
96
 
97
97
  Phony.define do
98
- country '55', match(/^(11|12|13|14|15|16|17|18|19|21|22|24|27|28)9\d{8}$/) >> split(5,4) |
99
- match(ndcs) >> split(4,4) |
100
- one_of(special_numbers_3_4) >> split(3,4) |
101
- one_of(special_numbers_4) >> split(4) |
102
- one_of(service) >> split(3) |
103
- fixed(3) >> split(3)
98
+ country '55',
99
+ match(/^(11|12|13|14|15|16|17|18|19|21|22|24|27|28)9\d{8}$/) >> split(5,4) |
100
+ match(ndcs) >> split(4,4) |
101
+ one_of(special_numbers_3_4) >> split(3,4) |
102
+ one_of(special_numbers_4) >> split(4) |
103
+ one_of(service) >> split(3) |
104
+ fixed(3) >> split(3)
104
105
  end
@@ -21,8 +21,10 @@ mobile = %w{ 130 131 132 133 135 136 137 138 139 145 150 151 152 153 155 156 157
21
21
  service = %w{ 110 114 119 120 122 999 } # Probably not exhaustive. TODO Look at http://www.eoc.com.cn/?action-viewnews-itemid-11493.
22
22
 
23
23
  Phony.define do
24
- country '86', one_of(service) >> split(8) |
25
- one_of(mobile) >> split(4,4) |
26
- one_of(ndcs) >> split(4,4) |
27
- fixed(3) >> split(4,4)
24
+ country '86',
25
+ trunk('0') |
26
+ one_of(service) >> split(8) |
27
+ one_of(mobile) >> split(4,4) |
28
+ one_of(ndcs) >> split(4,4) |
29
+ fixed(3) >> split(4,4)
28
30
  end
@@ -19,7 +19,8 @@ mobile = %w(
19
19
  )
20
20
 
21
21
  Phony.define do
22
- country '385', one_of(mobile) >> split(3, 4) |
22
+ country '385', trunk('0') |
23
+ one_of(mobile) >> split(3, 4) |
23
24
  one_of('1') >> split(4, 3) | # Zagreb
24
25
  fixed(2) >> split(3, 3) # 2-digit NDCs
25
26
  end
@@ -83,6 +83,7 @@ ndcs_with_6_subscirber_digits = %w(
83
83
 
84
84
  Phony.define do
85
85
  country '995',
86
+ trunk('0') |
86
87
  one_of('220') >> split(3,2) |
87
88
  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
88
89
  one_of(ndcs_with_6_subscirber_digits) >> split(3,3) |
@@ -4079,6 +4079,7 @@ service = [
4079
4079
  #
4080
4080
  Phony.define do
4081
4081
  country '49',
4082
+ trunk('0') |
4082
4083
  one_of(service) >> split(3,0) |
4083
4084
  match(/\A(151[124567]|152[012359]|157[035789]|1590)\d*\z/) >> split(3,4) |
4084
4085
  match(/\A(15\d)\d*\z/) >> split(3,4) |
@@ -38,10 +38,11 @@ mobile = %w{ 91 92 93 94 97 98 99 }
38
38
  pagers = %w{ 96 }
39
39
 
40
40
  Phony.define do
41
- country '91', one_of(sdca_with_3_digits) >> split(3, 2, 2) |
42
- one_of(sdca_with_2_digits) >> split(3, 2, 3) |
43
- one_of(mobile) >> split(3, 2, 3) |
44
- one_of(pagers) >> split(2, 3, 3) |
45
- fixed(4) >> split(3, 3) # fallback (4 digit sdca)
46
-
41
+ country '91',
42
+ trunk('0') |
43
+ one_of(sdca_with_3_digits) >> split(3, 2, 2) |
44
+ one_of(sdca_with_2_digits) >> split(3, 2, 3) |
45
+ one_of(mobile) >> split(3, 2, 3) |
46
+ one_of(pagers) >> split(2, 3, 3) |
47
+ fixed(4) >> split(3, 3) # fallback (4 digit sdca)
47
48
  end
@@ -4,47 +4,47 @@
4
4
 
5
5
  Phony.define do
6
6
  country '62',
7
- one_of('21') >> matched_split(
8
- /\A\d{5}\z/ => [3,2],
9
- /\A\d{7}\z/ => [3,4],
10
- /\A\d+\z/ => [4,4]) |
11
- one_of(%w(22 23 24 25 26 27 28 29 31 32 33 34 35 36 37 38 39 72)) >> matched_split(
12
- /\A\d{5}\z/ => [3,2],
13
- /\A\d+\z/ => [3,4]) |
14
- one_of('70') >> split(3,3) |
15
- one_of(%w(71 73 74 75 76 77)) >> matched_split(
16
- /\A\d{6}\z/ => [3,3],
17
- /\A\d+\z/ => [3,4]) |
18
- one_of('13') >> matched_split( # pager
19
- /\A\d{3}\z/ => [3],
20
- /\A\d+\z/ => [3,3]) |
21
- one_of(%w(174 175)) >> matched_split( # satellite
22
- /\A\d{2}\z/ => [2],
23
- /\A\d+\z/ => [2,3]) |
24
- one_of('177') >> matched_split( # satellite
25
- /\A\d{2}\z/ => [2],
26
- /\A\d+\z/ => [4,4]) |
27
- one_of('178') >> matched_split( # satellite
28
- /\A\d{3}\z/ => [3],
29
- /\A\d+\z/ => [3,2]) |
30
- one_of(%w(870)) >> split(3,2) | # satellite
31
- match(/\A(81\d|82\d|84\d|85\d|86\d|87\d|88\d)\d+\z/) >> matched_split( # mobile
32
- /\A\d{6}\z/ => [3,3],
33
- /\A\d{7}\z/ => [3,4],
34
- /\A\d+\z/ => [4,4]) |
35
- one_of(%w(9)) >> matched_split( # geographic
36
- /\A\d{7}\z/ => [4,3],
37
- /\A\d+\z/ => [3,3,3]) |
38
- one_of(%w(4 5)) >> matched_split(
39
- /\A\d{6}\z/ => [3,3],
40
- /\A\d+\z/ => [4,4]) |
41
- one_of('6') >> matched_split(
42
- /\A\d{7}\z/ => [3,4],
43
- /\A\d+\z/ => [4,4]) |
44
- one_of('9') >> matched_split(
45
- /\A\d{7}\z/ => [3,4],
46
- /\A\d+\z/ => [4,5]) |
47
- fixed(2) >> split(4,4)
48
-
7
+ trunk('0') |
8
+ one_of('21') >> matched_split(
9
+ /\A\d{5}\z/ => [3,2],
10
+ /\A\d{7}\z/ => [3,4],
11
+ /\A\d+\z/ => [4,4]) |
12
+ one_of(%w(22 23 24 25 26 27 28 29 31 32 33 34 35 36 37 38 39 72)) >> matched_split(
13
+ /\A\d{5}\z/ => [3,2],
14
+ /\A\d+\z/ => [3,4]) |
15
+ one_of('70') >> split(3,3) |
16
+ one_of(%w(71 73 74 75 76 77)) >> matched_split(
17
+ /\A\d{6}\z/ => [3,3],
18
+ /\A\d+\z/ => [3,4]) |
19
+ one_of('13') >> matched_split( # pager
20
+ /\A\d{3}\z/ => [3],
21
+ /\A\d+\z/ => [3,3]) |
22
+ one_of(%w(174 175)) >> matched_split( # satellite
23
+ /\A\d{2}\z/ => [2],
24
+ /\A\d+\z/ => [2,3]) |
25
+ one_of('177') >> matched_split( # satellite
26
+ /\A\d{2}\z/ => [2],
27
+ /\A\d+\z/ => [4,4]) |
28
+ one_of('178') >> matched_split( # satellite
29
+ /\A\d{3}\z/ => [3],
30
+ /\A\d+\z/ => [3,2]) |
31
+ one_of(%w(870)) >> split(3,2) | # satellite
32
+ match(/\A(81\d|82\d|84\d|85\d|86\d|87\d|88\d)\d+\z/) >> matched_split( # mobile
33
+ /\A\d{6}\z/ => [3,3],
34
+ /\A\d{7}\z/ => [3,4],
35
+ /\A\d+\z/ => [4,4]) |
36
+ one_of(%w(9)) >> matched_split( # geographic
37
+ /\A\d{7}\z/ => [4,3],
38
+ /\A\d+\z/ => [3,3,3]) |
39
+ one_of(%w(4 5)) >> matched_split(
40
+ /\A\d{6}\z/ => [3,3],
41
+ /\A\d+\z/ => [4,4]) |
42
+ one_of('6') >> matched_split(
43
+ /\A\d{7}\z/ => [3,4],
44
+ /\A\d+\z/ => [4,4]) |
45
+ one_of('9') >> matched_split(
46
+ /\A\d{7}\z/ => [3,4],
47
+ /\A\d+\z/ => [4,5]) |
48
+ fixed(2) >> split(4,4)
49
49
  end
50
50
 
@@ -401,12 +401,13 @@ ndcs_with_5_subscriber_numbers = %w(
401
401
 
402
402
  Phony.define do
403
403
  country '81',
404
- one_of(ndcs_with_5_subscriber_numbers) >> split(3,2) |
405
- one_of(ndcs_with_6_subscriber_numbers) >> split(3,3) |
406
- one_of(%w(120 800)) >> split(3,3) | # freephone
407
- one_of(ndcs_with_7_subscriber_numbers) >> split(4,3) |
408
- one_of(ndcs_with_8_subscriber_numbers) >> split(4,4) |
409
- one_of('20', '50', '60', '70', '90') >> split(4,4) | # mobile, VoIP telephony
410
- # TODO: 91(NDC) N(S)N length: 5-13 - Non-geographic number (Direct subscriber telephone service (legacy))
411
- fixed(2) >> split(4,4)
404
+ trunk('0') |
405
+ one_of(ndcs_with_5_subscriber_numbers) >> split(3,2) |
406
+ one_of(ndcs_with_6_subscriber_numbers) >> split(3,3) |
407
+ one_of(%w(120 800)) >> split(3,3) | # freephone
408
+ one_of(ndcs_with_7_subscriber_numbers) >> split(4,3) |
409
+ one_of(ndcs_with_8_subscriber_numbers) >> split(4,4) |
410
+ one_of('20', '50', '60', '70', '90') >> split(4,4) | # mobile, VoIP telephony
411
+ # TODO: 91(NDC) N(S)N length: 5-13 - Non-geographic number (Direct subscriber telephone service (legacy))
412
+ fixed(2) >> split(4,4)
412
413
  end
@@ -16,9 +16,11 @@ mobile = %w{ 10 11 12 13 14 153 154 156 158 16 17 18 19 }
16
16
  freephone = %w{ 300 700 800 }
17
17
 
18
18
  Phony.define do
19
- country '60', one_of(freephone) >> split(2,4) | # Freephone, Tollfree, Forwarding
20
- # one_of(service) >> none | # Service
21
- one_of(mobile) >> split(3,4..5) | # Mobile
22
- one_of(ndcs) >> split(8) | # 1-digit NDCs
23
- fixed(2) >> split(8) # 2-digit NDCs (Also, fallback)
19
+ country '60',
20
+ trunk('0') |
21
+ one_of(freephone) >> split(2,4) | # Freephone, Tollfree, Forwarding
22
+ # one_of(service) >> none | # Service
23
+ one_of(mobile) >> split(3,4..5) | # Mobile
24
+ one_of(ndcs) >> split(8) | # 1-digit NDCs
25
+ fixed(2) >> split(8) # 2-digit NDCs (Also, fallback)
24
26
  end
@@ -44,6 +44,7 @@ ndcs_with_5_subscriber_numbers = %w(
44
44
 
45
45
  Phony.define do
46
46
  country '373',
47
+ trunk('0') |
47
48
  one_of(ndcs_with_5_subscriber_numbers) >> split(3,2) |
48
49
  one_of(ndcs_with_6_subscriber_numbers) >> split(3,3) |
49
50
  fixed(3) >> split(3,2)
@@ -4,6 +4,7 @@
4
4
 
5
5
  Phony.define do
6
6
  country '382',
7
+ trunk('0') |
7
8
  one_of(%w(80)) >> split(3,3) | # freephone
8
9
  one_of(%w(20 30 31 40 52)) >> matched_split(
9
10
  /\A\d{5}\z/ => [3,2],
@@ -3,6 +3,7 @@
3
3
 
4
4
  Phony.define do
5
5
  country '381',
6
+ trunk('0') |
6
7
  one_of(%w(800)) >> split(3,2) | # freephone
7
8
  one_of(%w(808)) >> split(3,2) | # payphone
8
9
  one_of(%w(230)) >> matched_split(
@@ -10,11 +10,13 @@ special = %w{ 100 101 105 106 107 108 109 111 112 113 114 115 116 117 118 119 12
10
10
  # mobile = ('10'..'19').to_a # Note: Mobile not used as it is (for now) handled by the fixed catchall.
11
11
 
12
12
  Phony.define do
13
- country '82', match(/^(#{special.join("|")})$/) >> split(3,3) | # Special actually don't need to be split – but better err.
14
- one_of('2') >> split(4,4) | # Seoul, also includes "services".
15
- fixed(2) >> split(4,4) # Catchall.
16
-
17
- # See above.
18
- #
19
- # one_of(*mobile) >> split(4,4) |
13
+ country '82',
14
+ trunk('0') |
15
+ match(/^(#{special.join("|")})$/) >> split(3,3) | # Special actually don't need to be split – but better err.
16
+ one_of('2') >> split(4,4) | # Seoul, also includes "services".
17
+ fixed(2) >> split(4,4) # Catchall.
18
+
19
+ # See above.
20
+ #
21
+ # one_of(*mobile) >> split(4,4) |
20
22
  end
@@ -54,7 +54,9 @@ service = [
54
54
  ]
55
55
 
56
56
  Phony.define do
57
- country '46', one_of(service) >> split(3,3) |
58
- one_of(ndcs + mobile) >> split(3,2,2) |
59
- fixed(3) >> split(3,3,2) # catchall
57
+ country '46',
58
+ trunk('0') |
59
+ one_of(service) >> split(3,3) |
60
+ one_of(ndcs + mobile) >> split(3,2,2) |
61
+ fixed(3) >> split(3,3,2) # catchall
60
62
  end
@@ -36,16 +36,17 @@ ndcs_with_5_subscriber_numbers = %w(823 826 827)
36
36
 
37
37
  Phony.define do
38
38
  country '886',
39
- one_of(ndcs_with_5_subscriber_numbers) >> split(3,2) |
40
- match(/\A(6\d\d)\d{7}\z/) >> split(3,4) | # geographic ; Taipei
41
- one_of(%w(412)) >> split(4) | # VoIP telephony ; Taichung
42
- one_of(ndcs_with_6_subscriber_numbers) >> split(3,3) |
43
- one_of(%w(18)) >> split(3,3) | # freephone
44
- one_of(%w(90 91 92 93 95 96 97 98)) >> matched_split(
45
- /\A\d{6}\z/ => [3,3],
46
- /\A\d+\z/ => [3,4]) | # mobile
47
- one_of(%w(60 70 94 95 99)) >> split(3,3) | # pager
48
- one_of(ndcs_with_7_subscriber_numbers) >> split(3,4) |
49
- one_of(ndcs_with_8_subscriber_numbers) >> split(4,4) |
50
- fixed(2) >> split(3,3)
39
+ trunk('0') |
40
+ one_of(ndcs_with_5_subscriber_numbers) >> split(3,2) |
41
+ match(/\A(6\d\d)\d{7}\z/) >> split(3,4) | # geographic ; Taipei
42
+ one_of(%w(412)) >> split(4) | # VoIP telephony ; Taichung
43
+ one_of(ndcs_with_6_subscriber_numbers) >> split(3,3) |
44
+ one_of(%w(18)) >> split(3,3) | # freephone
45
+ one_of(%w(90 91 92 93 95 96 97 98)) >> matched_split(
46
+ /\A\d{6}\z/ => [3,3],
47
+ /\A\d+\z/ => [3,4]) | # mobile
48
+ one_of(%w(60 70 94 95 99)) >> split(3,3) | # pager
49
+ one_of(ndcs_with_7_subscriber_numbers) >> split(3,4) |
50
+ one_of(ndcs_with_8_subscriber_numbers) >> split(4,4) |
51
+ fixed(2) >> split(3,3)
51
52
  end
@@ -615,12 +615,13 @@ ndcs_with_3_subscriber_numbers = %w(433861)
615
615
 
616
616
  Phony.define do
617
617
  country '380',
618
- one_of(ndcs_with_3_subscriber_numbers) >> split(3) |
619
- one_of(ndcs_with_4_subscriber_numbers) >> split(4) |
620
- one_of(ndcs_with_5_subscriber_numbers) >> split(3,2) |
621
- one_of(ndcs_with_6_subscriber_numbers) >> split(3,3) |
622
- one_of(seven_digit_mobile_prefixes) >> split(3,2,2) |
623
- one_of('800') >> split(3,3) | # freephone
624
- one_of(ndcs_with_7_subscriber_numbers) >> split(4,3) |
625
- fixed(3) >> split(3,3) # other
618
+ trunk('0') |
619
+ one_of(ndcs_with_3_subscriber_numbers) >> split(3) |
620
+ one_of(ndcs_with_4_subscriber_numbers) >> split(4) |
621
+ one_of(ndcs_with_5_subscriber_numbers) >> split(3,2) |
622
+ one_of(ndcs_with_6_subscriber_numbers) >> split(3,3) |
623
+ one_of(seven_digit_mobile_prefixes) >> split(3,2,2) |
624
+ one_of('800') >> split(3,3) | # freephone
625
+ one_of(ndcs_with_7_subscriber_numbers) >> split(4,3) |
626
+ fixed(3) >> split(3,3) # other
626
627
  end
@@ -790,13 +790,15 @@ four_digit_ndc = [
790
790
  ]
791
791
 
792
792
  Phony.define do
793
- country '44', one_of(mobile_ndc) >> split(6) | # 4-6
794
- one_of(two_digit_ndc) >> split(4,4) | # 2-4-4
795
- match(/^([58]00)\d{6}$/) >> split(6) | # 3-6, Special handling for 500 and 800.
796
- one_of(three_digit_ndc) >> split(3,4) | # 3-3-4
797
- match(/^(16977)\d{4}$/) >> split(4) | # 5-4, Special handling for 16977.
798
- one_of(five_digit_ndc) >> split(5) | # 5-5
799
- one_of(variable_length_number) >> split(6) | # 4-6 and 4-5, in 40 areas.
800
- one_of(four_digit_ndc) >> split(6) | # 4-6
801
- fixed(4) >> split(6) # Catchall for undefined numbers.
793
+ country '44',
794
+ trunk('0') |
795
+ one_of(mobile_ndc) >> split(6) | # 4-6
796
+ one_of(two_digit_ndc) >> split(4,4) | # 2-4-4
797
+ match(/^([58]00)\d{6}$/) >> split(6) | # 3-6, Special handling for 500 and 800.
798
+ one_of(three_digit_ndc) >> split(3,4) | # 3-3-4
799
+ match(/^(16977)\d{4}$/) >> split(4) | # 5-4, Special handling for 16977.
800
+ one_of(five_digit_ndc) >> split(5) | # 5-5
801
+ one_of(variable_length_number) >> split(6) | # 4-6 and 4-5, in 40 areas.
802
+ one_of(four_digit_ndc) >> split(6) | # 4-6
803
+ fixed(4) >> split(6) # Catchall for undefined numbers.
802
804
  end
@@ -119,11 +119,13 @@ mobile = [
119
119
  mobile_with_trunk = mobile.map{|num| "0#{num}" }
120
120
 
121
121
  Phony.define do
122
- country '84', one_of(ndcs_with_7_subscriber_digits) >> split(3,4) |
123
- one_of(ndcs_with_8_subscriber_digits) >> split(4,4) |
124
- one_of(mobile) >> split(5..8)|
125
- one_of(mobile_with_trunk) >> split(5..8)|
126
- # Govt reserved
127
- fixed(80) >> split(5) |
128
- fixed(69) >> split(1,5)
122
+ country '84',
123
+ trunk('0') |
124
+ one_of(ndcs_with_7_subscriber_digits) >> split(3,4) |
125
+ one_of(ndcs_with_8_subscriber_digits) >> split(4,4) |
126
+ one_of(mobile) >> split(5..8)|
127
+ one_of(mobile_with_trunk) >> split(5..8)|
128
+ # Govt reserved
129
+ fixed(80) >> split(5) |
130
+ fixed(69) >> split(1,5)
129
131
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phony
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.3
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Hanke