phony 2.20.13 → 2.22.2

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.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/README.textile +1 -1
  3. data/lib/phony/config.rb +25 -26
  4. data/lib/phony/countries/argentina.rb +311 -314
  5. data/lib/phony/countries/austria.rb +71 -72
  6. data/lib/phony/countries/bangladesh.rb +27 -28
  7. data/lib/phony/countries/belarus.rb +110 -111
  8. data/lib/phony/countries/brazil.rb +92 -92
  9. data/lib/phony/countries/cambodia.rb +9 -9
  10. data/lib/phony/countries/china.rb +22 -21
  11. data/lib/phony/countries/croatia.rb +6 -5
  12. data/lib/phony/countries/georgia.rb +84 -84
  13. data/lib/phony/countries/germany.rb +4067 -4068
  14. data/lib/phony/countries/guinea.rb +8 -8
  15. data/lib/phony/countries/india.rb +31 -34
  16. data/lib/phony/countries/indonesia.rb +57 -46
  17. data/lib/phony/countries/ireland.rb +4 -5
  18. data/lib/phony/countries/italy.rb +54 -53
  19. data/lib/phony/countries/japan.rb +456 -456
  20. data/lib/phony/countries/kyrgyzstan.rb +109 -109
  21. data/lib/phony/countries/latvia.rb +34 -34
  22. data/lib/phony/countries/libya.rb +106 -106
  23. data/lib/phony/countries/malaysia.rb +12 -12
  24. data/lib/phony/countries/moldova.rb +42 -42
  25. data/lib/phony/countries/montenegro.rb +24 -20
  26. data/lib/phony/countries/myanmar.rb +39 -39
  27. data/lib/phony/countries/namibia.rb +35 -29
  28. data/lib/phony/countries/nepal.rb +60 -62
  29. data/lib/phony/countries/netherlands.rb +13 -13
  30. data/lib/phony/countries/pakistan.rb +135 -111
  31. data/lib/phony/countries/paraguay.rb +135 -135
  32. data/lib/phony/countries/russia_kazakhstan_abkhasia_south_ossetia.rb +125 -128
  33. data/lib/phony/countries/saudi_arabia.rb +5 -5
  34. data/lib/phony/countries/serbia.rb +47 -39
  35. data/lib/phony/countries/somalia.rb +18 -18
  36. data/lib/phony/countries/south_korea.rb +16 -13
  37. data/lib/phony/countries/sweden.rb +28 -28
  38. data/lib/phony/countries/taiwan.rb +20 -19
  39. data/lib/phony/countries/tajikistan.rb +70 -70
  40. data/lib/phony/countries/turkmenistan.rb +65 -65
  41. data/lib/phony/countries/ukraine.rb +607 -607
  42. data/lib/phony/countries/united_kingdom.rb +66 -66
  43. data/lib/phony/countries/uruguay.rb +40 -41
  44. data/lib/phony/countries/vietnam.rb +19 -17
  45. data/lib/phony/countries/zimbabwe.rb +31 -31
  46. data/lib/phony/countries.rb +457 -443
  47. data/lib/phony/country.rb +44 -44
  48. data/lib/phony/country_codes.rb +67 -60
  49. data/lib/phony/dsl.rb +23 -26
  50. data/lib/phony/local_splitters/fixed.rb +23 -30
  51. data/lib/phony/local_splitters/regex.rb +30 -31
  52. data/lib/phony/national_code.rb +7 -10
  53. data/lib/phony/national_splitters/default.rb +9 -11
  54. data/lib/phony/national_splitters/dsl.rb +8 -18
  55. data/lib/phony/national_splitters/fixed.rb +12 -15
  56. data/lib/phony/national_splitters/none.rb +7 -11
  57. data/lib/phony/national_splitters/regex.rb +13 -17
  58. data/lib/phony/national_splitters/variable.rb +37 -38
  59. data/lib/phony/trunk_code.rb +20 -20
  60. data/lib/phony/vanity.rb +12 -13
  61. data/lib/phony.rb +84 -84
  62. metadata +5 -42
  63. data/spec/functional/config_spec.rb +0 -44
  64. data/spec/functional/plausibility_spec.rb +0 -689
  65. data/spec/lib/phony/countries_spec.rb +0 -1459
  66. data/spec/lib/phony/country_codes_spec.rb +0 -227
  67. data/spec/lib/phony/country_spec.rb +0 -104
  68. data/spec/lib/phony/dsl_spec.rb +0 -28
  69. data/spec/lib/phony/local_splitters/fixed_spec.rb +0 -56
  70. data/spec/lib/phony/local_splitters/regex_spec.rb +0 -94
  71. data/spec/lib/phony/national_code_spec.rb +0 -61
  72. data/spec/lib/phony/national_splitters/default_spec.rb +0 -34
  73. data/spec/lib/phony/national_splitters/fixed_spec.rb +0 -45
  74. data/spec/lib/phony/national_splitters/none_spec.rb +0 -28
  75. data/spec/lib/phony/national_splitters/regex_spec.rb +0 -23
  76. data/spec/lib/phony/national_splitters/variable_spec.rb +0 -35
  77. data/spec/lib/phony/trunk_code_spec.rb +0 -85
  78. data/spec/lib/phony/vanity_spec.rb +0 -30
  79. data/spec/lib/phony_spec.rb +0 -70
@@ -4,117 +4,117 @@
4
4
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
5
5
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=KG
6
6
 
7
- ndcs_with_6_subscriber_digits = %w(312 315)
7
+ ndcs_with_6_subscriber_digits = %w[312 315]
8
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
- )
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
111
 
112
112
  Phony.define do
113
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)
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
120
  end
@@ -4,40 +4,40 @@
4
4
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=LV
5
5
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
6
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
- )
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
34
 
35
- ndcs_with_6_subscriber_numbers = %w(67)
35
+ ndcs_with_6_subscriber_numbers = %w[67]
36
36
 
37
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
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
@@ -3,114 +3,114 @@
3
3
  # Lybia, https://www.numberingplans.com/?page=dialling&sub=areacodes
4
4
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=LY
5
5
 
6
- ndcs_with_7_subscriber_numbers = %w(21)
6
+ ndcs_with_7_subscriber_numbers = %w[21]
7
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
- )
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
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
- )
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
108
 
109
109
  Phony.define do
110
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
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
@@ -10,7 +10,7 @@ ndcs = [
10
10
  '5', # Perak & Cameron Highlands (Pahang)
11
11
  '6', # Melaka, Negeri Sembilan & Muar (Johor)
12
12
  '7', # Johor (except Muar)
13
- '9', # Kelantan, Pahang (except Cameron Highlands & Genting Highlands) & Terengganu
13
+ '9' # Kelantan, Pahang (except Cameron Highlands & Genting Highlands) & Terengganu
14
14
  ]
15
15
 
16
16
  ndcs_two_digits = [
@@ -23,24 +23,24 @@ ndcs_two_digits = [
23
23
  '86', # Sarawak – Bintulu and Belaga
24
24
  '87', # Labuan Interior Division, Sabah
25
25
  '88', # Sabah – Kota Kinabalu and Kudat
26
- '89', # Sabah – Lahad Datu, Sandakan and Tawau
26
+ '89' # Sabah – Lahad Datu, Sandakan and Tawau
27
27
  ]
28
28
 
29
- mobile = %w{ 10 11 12 13 14 153 154 156 158 16 17 18 19 }
29
+ mobile = %w[10 11 12 13 14 153 154 156 158 16 17 18 19]
30
30
  # service = %w{ 100 101 102 103 104 108 991 994 995 999 } # Emergeny and Service numbers, only 3 digits long
31
- freephone = %w{ 300 700 800 }
31
+ freephone = %w[300 700 800]
32
32
  ndcs_eight = [
33
33
  '3' # Selangor & Federal Territories of Kuala Lumpur & Putrajaya & also Genting Highlands, Pahang
34
34
  ]
35
35
 
36
36
  Phony.define do
37
37
  country '60',
38
- trunk('0') |
39
- one_of(freephone) >> split(2,4) | # Freephone, Tollfree, Forwarding
40
- # one_of(service) >> none | # Service
41
- one_of(mobile) >> split(3,4..5) | # Mobile
42
- one_of(ndcs_two_digits) >> split(6) | # 2-digit NDCs
43
- one_of(ndcs) >> split(7) | # 1-digit NDCs
44
- one_of(ndcs_eight) >> split(8) | # 1-digit NDCs
45
- fixed(2) >> split(8) # 2-digit NDCs (Also, fallback)
38
+ trunk('0') |
39
+ one_of(freephone) >> split(2, 4) | # Freephone, Tollfree, Forwarding
40
+ # one_of(service) >> none | # Service
41
+ one_of(mobile) >> split(3, 4..5) | # Mobile
42
+ one_of(ndcs_two_digits) >> split(6) | # 2-digit NDCs
43
+ one_of(ndcs) >> split(7) | # 1-digit NDCs
44
+ one_of(ndcs_eight) >> split(8) | # 1-digit NDCs
45
+ fixed(2) >> split(8) # 2-digit NDCs (Also, fallback)
46
46
  end
@@ -4,50 +4,50 @@
4
4
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
5
5
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=MD
6
6
 
7
- ndcs_with_6_subscriber_numbers = %w(22)
8
- ndcs_with_5_subscriber_numbers = %w(
9
- 230
10
- 231
11
- 235
12
- 236
13
- 237
14
- 241
15
- 242
16
- 243
17
- 244
18
- 246
19
- 247
20
- 248
21
- 249
22
- 250
23
- 251
24
- 252
25
- 254
26
- 256
27
- 258
28
- 259
29
- 262
30
- 263
31
- 264
32
- 265
33
- 268
34
- 269
35
- 271
36
- 272
37
- 273
38
- 277
39
- 291
40
- 293
41
- 294
42
- 297
43
- 298
44
- 299
45
- )
7
+ ndcs_with_6_subscriber_numbers = %w[22]
8
+ ndcs_with_5_subscriber_numbers = %w[
9
+ 230
10
+ 231
11
+ 235
12
+ 236
13
+ 237
14
+ 241
15
+ 242
16
+ 243
17
+ 244
18
+ 246
19
+ 247
20
+ 248
21
+ 249
22
+ 250
23
+ 251
24
+ 252
25
+ 254
26
+ 256
27
+ 258
28
+ 259
29
+ 262
30
+ 263
31
+ 264
32
+ 265
33
+ 268
34
+ 269
35
+ 271
36
+ 272
37
+ 273
38
+ 277
39
+ 291
40
+ 293
41
+ 294
42
+ 297
43
+ 298
44
+ 299
45
+ ]
46
46
 
47
47
  Phony.define do
48
48
  country '373',
49
49
  trunk('0') |
50
- one_of(ndcs_with_5_subscriber_numbers) >> split(3,2) |
51
- one_of(ndcs_with_6_subscriber_numbers) >> split(3,3) |
52
- fixed(3) >> split(3,2)
50
+ one_of(ndcs_with_5_subscriber_numbers) >> split(3, 2) |
51
+ one_of(ndcs_with_6_subscriber_numbers) >> split(3, 3) |
52
+ fixed(3) >> split(3, 2)
53
53
  end