floere/phony

View on GitHub
lib/phony/countries/ukraine.rb

Summary

Maintainability
C
1 day
Test Coverage
# frozen_string_literal: true

# Ukraine
# https://www.numberingplans.com/?page=dialling&sub=areacodes

ndcs_with_7_subscriber_numbers = %w(
32
33
34
35
36
37
38
41
43
44
45
46
47
48
51
52
53
54
55
56
57
61
62
64
65
69
72
)

ndcs_with_6_subscriber_numbers = %w(
312
322
332
342
352
362
372
382
412
432
462
472
482
512
522
532
542
552
562
564
572
612
622
629
642
652
654
692
)

ndcs_with_5_subscriber_numbers = %w(
3122
3131
3132
3133
3134
3135
3136
3137
3141
3143
3144
3145
3146
3230
3231
3234
3236
3238
3239
3241
3244
3245
3247
3248
3249
3251
3252
3254
3255
3257
3259
3261
3263
3264
3265
3266
3269
3322
3342
3344
3346
3352
3357
3362
3363
3365
3366
3368
3372
3374
3376
3377
3379
3430
3431
3432
3433
3434
3435
3436
3438
3471
3472
3474
3475
3476
3477
3478
3479
3540
3541
3542
3543
3544
3546
3547
3548
3549
3550
3551
3552
3554
3555
3556
3557
3558
3632
3633
3634
3635
3636
3650
3651
3652
3653
3654
3656
3657
3658
3659
3722
3730
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3822
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
4122
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4161
4162
4191
4330
4331
4332
4333
4334
4335
4336
4337
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4355
4356
4358
4460
4461
4462
4463
4464
4465
4466
4467
4468
4470
4471
4472
4473
4475
4476
4477
4478
4479
4491
4492
4493
4494
4495
4496
4497
4498
4622
4631
4632
4633
4634
4635
4636
4637
4639
4641
4642
4643
4644
4645
4646
4653
4654
4655
4656
4657
4658
4659
4722
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4744
4745
4746
4747
4748
4749
4840
4841
4843
4844
4845
4846
4847
4848
4849
4851
4852
4853
4854
4855
4856
4858
4859
4860
4861
4862
4864
4865
4866
4867
4868
5131
5132
5133
5134
5135
5136
5151
5152
5153
5154
5158
5159
5161
5162
5163
5164
5167
5168
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5340
5341
5342
5343
5344
5345
5346
5347
5348
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5362
5363
5364
5365
5422
5442
5443
5444
5445
5446
5447
5448
5449
5451
5452
5453
5454
5455
5456
5457
5458
5459
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5542
5544
5545
5546
5547
5548
5549
5610
5611
5612
5615
5616
5617
5618
5650
5652
5653
5655
5656
5657
5662
5665
5667
5668
5670
5671
5672
5673
5678
5679
5692
5733
5740
5741
5742
5743
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5758
5759
5761
5762
5763
5764
5765
6131
6132
6133
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6147
6153
6162
6165
6175
6178
6212
6213
6214
6217
6232
6236
6237
6239
6242
6247
6249
6250
6252
6254
6255
6256
6257
6259
6261
6262
6264
6267
6269
6272
6273
6274
6277
6279
6296
6297
6299
6431
6432
6433
6434
6435
6436
6441
6442
6443
6444
6445
6446
6451
6452
6453
6454
6455
6456
6461
6462
6463
6464
6465
6471
6472
6473
6474
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6569
)

ndcs_with_4_subscriber_numbers = %w(
31422
32606
34342
36522
36552
37312
41372
41444
41483
41494
43388
43410
44474
53615
55431
56510
57442
57572
)

seven_digit_mobile_prefixes = [
  '50', '66', '95', '99',  # Vodafone
  '67', '96', '97', '98',  # Kyivstar
  '63', '93', '73',        # Lifecell
  '39', # Kyivstar(Golden Telecom)
  '68', # Kyivstar(Beeline)
  '91', # UTEL
  '92', # PEOPLEnet
  '94'  # Intertelecom
]

ndcs_with_3_subscriber_numbers = %w(433861)

Phony.define do
  country '380',
    trunk('0') |
    one_of(ndcs_with_3_subscriber_numbers) >> split(3) |
    one_of(ndcs_with_4_subscriber_numbers) >> split(4) |
    one_of(ndcs_with_5_subscriber_numbers) >> split(3,2) |
    one_of(ndcs_with_6_subscriber_numbers) >> split(3,3) |
    one_of(seven_digit_mobile_prefixes)    >> split(3,2,2) |
    one_of('800') >> split(3,3) | # freephone
    one_of(ndcs_with_7_subscriber_numbers) >> split(4,3) |
    fixed(3) >> split(3,3) # other
end