phony 2.20.13 → 2.20.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/lib/phony/config.rb +25 -26
  3. data/lib/phony/countries/argentina.rb +311 -314
  4. data/lib/phony/countries/austria.rb +71 -72
  5. data/lib/phony/countries/bangladesh.rb +27 -28
  6. data/lib/phony/countries/belarus.rb +110 -111
  7. data/lib/phony/countries/brazil.rb +92 -92
  8. data/lib/phony/countries/cambodia.rb +9 -9
  9. data/lib/phony/countries/china.rb +22 -21
  10. data/lib/phony/countries/croatia.rb +6 -5
  11. data/lib/phony/countries/georgia.rb +84 -84
  12. data/lib/phony/countries/germany.rb +4067 -4068
  13. data/lib/phony/countries/guinea.rb +8 -8
  14. data/lib/phony/countries/india.rb +31 -34
  15. data/lib/phony/countries/indonesia.rb +57 -46
  16. data/lib/phony/countries/ireland.rb +4 -5
  17. data/lib/phony/countries/italy.rb +54 -53
  18. data/lib/phony/countries/japan.rb +456 -456
  19. data/lib/phony/countries/kyrgyzstan.rb +109 -109
  20. data/lib/phony/countries/latvia.rb +34 -34
  21. data/lib/phony/countries/libya.rb +106 -106
  22. data/lib/phony/countries/malaysia.rb +12 -12
  23. data/lib/phony/countries/moldova.rb +42 -42
  24. data/lib/phony/countries/montenegro.rb +24 -20
  25. data/lib/phony/countries/myanmar.rb +39 -39
  26. data/lib/phony/countries/namibia.rb +35 -29
  27. data/lib/phony/countries/nepal.rb +60 -62
  28. data/lib/phony/countries/netherlands.rb +13 -13
  29. data/lib/phony/countries/pakistan.rb +135 -111
  30. data/lib/phony/countries/paraguay.rb +135 -135
  31. data/lib/phony/countries/russia_kazakhstan_abkhasia_south_ossetia.rb +125 -128
  32. data/lib/phony/countries/saudi_arabia.rb +5 -5
  33. data/lib/phony/countries/serbia.rb +47 -39
  34. data/lib/phony/countries/somalia.rb +18 -18
  35. data/lib/phony/countries/south_korea.rb +16 -13
  36. data/lib/phony/countries/sweden.rb +28 -28
  37. data/lib/phony/countries/taiwan.rb +20 -19
  38. data/lib/phony/countries/tajikistan.rb +70 -70
  39. data/lib/phony/countries/turkmenistan.rb +65 -65
  40. data/lib/phony/countries/ukraine.rb +607 -607
  41. data/lib/phony/countries/united_kingdom.rb +66 -66
  42. data/lib/phony/countries/uruguay.rb +40 -41
  43. data/lib/phony/countries/vietnam.rb +18 -17
  44. data/lib/phony/countries/zimbabwe.rb +31 -31
  45. data/lib/phony/countries.rb +440 -443
  46. data/lib/phony/country.rb +42 -44
  47. data/lib/phony/country_codes.rb +61 -60
  48. data/lib/phony/dsl.rb +23 -26
  49. data/lib/phony/local_splitters/fixed.rb +20 -29
  50. data/lib/phony/local_splitters/regex.rb +28 -31
  51. data/lib/phony/national_code.rb +7 -10
  52. data/lib/phony/national_splitters/default.rb +9 -11
  53. data/lib/phony/national_splitters/dsl.rb +8 -18
  54. data/lib/phony/national_splitters/fixed.rb +11 -14
  55. data/lib/phony/national_splitters/none.rb +7 -11
  56. data/lib/phony/national_splitters/regex.rb +13 -17
  57. data/lib/phony/national_splitters/variable.rb +36 -38
  58. data/lib/phony/trunk_code.rb +16 -18
  59. data/lib/phony/vanity.rb +12 -13
  60. data/lib/phony.rb +84 -84
  61. metadata +5 -39
  62. data/spec/functional/config_spec.rb +0 -44
  63. data/spec/functional/plausibility_spec.rb +0 -689
  64. data/spec/lib/phony/countries_spec.rb +0 -1459
  65. data/spec/lib/phony/country_codes_spec.rb +0 -227
  66. data/spec/lib/phony/country_spec.rb +0 -104
  67. data/spec/lib/phony/dsl_spec.rb +0 -28
  68. data/spec/lib/phony/local_splitters/fixed_spec.rb +0 -56
  69. data/spec/lib/phony/local_splitters/regex_spec.rb +0 -94
  70. data/spec/lib/phony/national_code_spec.rb +0 -61
  71. data/spec/lib/phony/national_splitters/default_spec.rb +0 -34
  72. data/spec/lib/phony/national_splitters/fixed_spec.rb +0 -45
  73. data/spec/lib/phony/national_splitters/none_spec.rb +0 -28
  74. data/spec/lib/phony/national_splitters/regex_spec.rb +0 -23
  75. data/spec/lib/phony/national_splitters/variable_spec.rb +0 -35
  76. data/spec/lib/phony/trunk_code_spec.rb +0 -85
  77. data/spec/lib/phony/vanity_spec.rb +0 -30
  78. data/spec/lib/phony_spec.rb +0 -70
@@ -7,315 +7,314 @@
7
7
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Argentina
8
8
  # Area codes collected from https://www.enacom.gob.ar/indicativos-interurbanos_p366 (06/27/19)
9
9
 
10
-
11
10
  # Landline
12
11
  area_codes_2digits = [
13
- '11',
12
+ '11'
14
13
  ]
15
14
 
16
- area_codes_3digits = [
17
- '220',
18
- '221',
19
- '223',
20
- '230',
21
- '236',
22
- '237',
23
- '249',
24
- '260',
25
- '261',
26
- '263',
27
- '264',
28
- '266',
29
- '280',
30
- '291',
31
- '294',
32
- '297',
33
- '298',
34
- '299',
35
- '336',
36
- '341',
37
- '342',
38
- '343',
39
- '345',
40
- '348',
41
- '351',
42
- '353',
43
- '358',
44
- '362',
45
- '364',
46
- '370',
47
- '376',
48
- '379',
49
- '380',
50
- '381',
51
- '383',
52
- '385',
53
- '387',
54
- '388',
15
+ area_codes_3digits = %w[
16
+ 220
17
+ 221
18
+ 223
19
+ 230
20
+ 236
21
+ 237
22
+ 249
23
+ 260
24
+ 261
25
+ 263
26
+ 264
27
+ 266
28
+ 280
29
+ 291
30
+ 294
31
+ 297
32
+ 298
33
+ 299
34
+ 336
35
+ 341
36
+ 342
37
+ 343
38
+ 345
39
+ 348
40
+ 351
41
+ 353
42
+ 358
43
+ 362
44
+ 364
45
+ 370
46
+ 376
47
+ 379
48
+ 380
49
+ 381
50
+ 383
51
+ 385
52
+ 387
53
+ 388
55
54
  ]
56
55
 
57
- area_codes_4digits = [
58
- '2202',
59
- '2221',
60
- '2223',
61
- '2224',
62
- '2225',
63
- '2226',
64
- '2227',
65
- '2229',
66
- '2241',
67
- '2242',
68
- '2243',
69
- '2244',
70
- '2245',
71
- '2246',
72
- '2252',
73
- '2254',
74
- '2255',
75
- '2257',
76
- '2261',
77
- '2262',
78
- '2264',
79
- '2265',
80
- '2266',
81
- '2267',
82
- '2268',
83
- '2271',
84
- '2272',
85
- '2273',
86
- '2274',
87
- '2281',
88
- '2283',
89
- '2284',
90
- '2285',
91
- '2286',
92
- '2291',
93
- '2292',
94
- '2296',
95
- '2297',
96
- '2302',
97
- '2314',
98
- '2316',
99
- '2317',
100
- '2320',
101
- '2323',
102
- '2324',
103
- '2325',
104
- '2326',
105
- '2331',
106
- '2333',
107
- '2334',
108
- '2335',
109
- '2336',
110
- '2337',
111
- '2338',
112
- '2342',
113
- '2343',
114
- '2344',
115
- '2345',
116
- '2346',
117
- '2352',
118
- '2353',
119
- '2354',
120
- '2355',
121
- '2356',
122
- '2357',
123
- '2358',
124
- '2392',
125
- '2393',
126
- '2394',
127
- '2395',
128
- '2396',
129
- '2473',
130
- '2474',
131
- '2475',
132
- '2477',
133
- '2478',
134
- '2622',
135
- '2624',
136
- '2625',
137
- '2626',
138
- '2646',
139
- '2647',
140
- '2648',
141
- '2651',
142
- '2655',
143
- '2656',
144
- '2657',
145
- '2658',
146
- '2901',
147
- '2902',
148
- '2903',
149
- '2920',
150
- '2921',
151
- '2922',
152
- '2923',
153
- '2924',
154
- '2925',
155
- '2926',
156
- '2927',
157
- '2928',
158
- '2929',
159
- '2931',
160
- '2932',
161
- '2933',
162
- '2934',
163
- '2935',
164
- '2936',
165
- '2940',
166
- '2942',
167
- '2945',
168
- '2946',
169
- '2948',
170
- '2952',
171
- '2953',
172
- '2954',
173
- '2962',
174
- '2963',
175
- '2964',
176
- '2966',
177
- '2972',
178
- '2982',
179
- '2983',
180
- '3327',
181
- '3329',
182
- '3382',
183
- '3385',
184
- '3387',
185
- '3388',
186
- '3400',
187
- '3401',
188
- '3402',
189
- '3404',
190
- '3405',
191
- '3406',
192
- '3407',
193
- '3408',
194
- '3409',
195
- '3435',
196
- '3436',
197
- '3437',
198
- '3438',
199
- '3442',
200
- '3444',
201
- '3445',
202
- '3446',
203
- '3447',
204
- '3454',
205
- '3455',
206
- '3456',
207
- '3458',
208
- '3460',
209
- '3462',
210
- '3463',
211
- '3464',
212
- '3465',
213
- '3466',
214
- '3467',
215
- '3468',
216
- '3469',
217
- '3471',
218
- '3472',
219
- '3476',
220
- '3482',
221
- '3483',
222
- '3487',
223
- '3489',
224
- '3491',
225
- '3492',
226
- '3493',
227
- '3496',
228
- '3497',
229
- '3498',
230
- '3521',
231
- '3522',
232
- '3524',
233
- '3525',
234
- '3532',
235
- '3533',
236
- '3537',
237
- '3541',
238
- '3542',
239
- '3543',
240
- '3544',
241
- '3546',
242
- '3547',
243
- '3548',
244
- '3549',
245
- '3562',
246
- '3563',
247
- '3564',
248
- '3571',
249
- '3572',
250
- '3573',
251
- '3574',
252
- '3575',
253
- '3576',
254
- '3582',
255
- '3583',
256
- '3584',
257
- '3585',
258
- '3711',
259
- '3715',
260
- '3716',
261
- '3718',
262
- '3721',
263
- '3725',
264
- '3731',
265
- '3734',
266
- '3735',
267
- '3741',
268
- '3743',
269
- '3751',
270
- '3754',
271
- '3755',
272
- '3756',
273
- '3757',
274
- '3758',
275
- '3772',
276
- '3773',
277
- '3774',
278
- '3775',
279
- '3777',
280
- '3781',
281
- '3782',
282
- '3786',
283
- '3821',
284
- '3825',
285
- '3826',
286
- '3827',
287
- '3832',
288
- '3835',
289
- '3837',
290
- '3838',
291
- '3841',
292
- '3843',
293
- '3844',
294
- '3845',
295
- '3846',
296
- '3854',
297
- '3855',
298
- '3856',
299
- '3857',
300
- '3858',
301
- '3861',
302
- '3862',
303
- '3863',
304
- '3865',
305
- '3867',
306
- '3868',
307
- '3869',
308
- '3873',
309
- '3876',
310
- '3877',
311
- '3878',
312
- '3885',
313
- '3886',
314
- '3887',
315
- '3888',
316
- '3891',
317
- '3892',
318
- '3894',
56
+ area_codes_4digits = %w[
57
+ 2202
58
+ 2221
59
+ 2223
60
+ 2224
61
+ 2225
62
+ 2226
63
+ 2227
64
+ 2229
65
+ 2241
66
+ 2242
67
+ 2243
68
+ 2244
69
+ 2245
70
+ 2246
71
+ 2252
72
+ 2254
73
+ 2255
74
+ 2257
75
+ 2261
76
+ 2262
77
+ 2264
78
+ 2265
79
+ 2266
80
+ 2267
81
+ 2268
82
+ 2271
83
+ 2272
84
+ 2273
85
+ 2274
86
+ 2281
87
+ 2283
88
+ 2284
89
+ 2285
90
+ 2286
91
+ 2291
92
+ 2292
93
+ 2296
94
+ 2297
95
+ 2302
96
+ 2314
97
+ 2316
98
+ 2317
99
+ 2320
100
+ 2323
101
+ 2324
102
+ 2325
103
+ 2326
104
+ 2331
105
+ 2333
106
+ 2334
107
+ 2335
108
+ 2336
109
+ 2337
110
+ 2338
111
+ 2342
112
+ 2343
113
+ 2344
114
+ 2345
115
+ 2346
116
+ 2352
117
+ 2353
118
+ 2354
119
+ 2355
120
+ 2356
121
+ 2357
122
+ 2358
123
+ 2392
124
+ 2393
125
+ 2394
126
+ 2395
127
+ 2396
128
+ 2473
129
+ 2474
130
+ 2475
131
+ 2477
132
+ 2478
133
+ 2622
134
+ 2624
135
+ 2625
136
+ 2626
137
+ 2646
138
+ 2647
139
+ 2648
140
+ 2651
141
+ 2655
142
+ 2656
143
+ 2657
144
+ 2658
145
+ 2901
146
+ 2902
147
+ 2903
148
+ 2920
149
+ 2921
150
+ 2922
151
+ 2923
152
+ 2924
153
+ 2925
154
+ 2926
155
+ 2927
156
+ 2928
157
+ 2929
158
+ 2931
159
+ 2932
160
+ 2933
161
+ 2934
162
+ 2935
163
+ 2936
164
+ 2940
165
+ 2942
166
+ 2945
167
+ 2946
168
+ 2948
169
+ 2952
170
+ 2953
171
+ 2954
172
+ 2962
173
+ 2963
174
+ 2964
175
+ 2966
176
+ 2972
177
+ 2982
178
+ 2983
179
+ 3327
180
+ 3329
181
+ 3382
182
+ 3385
183
+ 3387
184
+ 3388
185
+ 3400
186
+ 3401
187
+ 3402
188
+ 3404
189
+ 3405
190
+ 3406
191
+ 3407
192
+ 3408
193
+ 3409
194
+ 3435
195
+ 3436
196
+ 3437
197
+ 3438
198
+ 3442
199
+ 3444
200
+ 3445
201
+ 3446
202
+ 3447
203
+ 3454
204
+ 3455
205
+ 3456
206
+ 3458
207
+ 3460
208
+ 3462
209
+ 3463
210
+ 3464
211
+ 3465
212
+ 3466
213
+ 3467
214
+ 3468
215
+ 3469
216
+ 3471
217
+ 3472
218
+ 3476
219
+ 3482
220
+ 3483
221
+ 3487
222
+ 3489
223
+ 3491
224
+ 3492
225
+ 3493
226
+ 3496
227
+ 3497
228
+ 3498
229
+ 3521
230
+ 3522
231
+ 3524
232
+ 3525
233
+ 3532
234
+ 3533
235
+ 3537
236
+ 3541
237
+ 3542
238
+ 3543
239
+ 3544
240
+ 3546
241
+ 3547
242
+ 3548
243
+ 3549
244
+ 3562
245
+ 3563
246
+ 3564
247
+ 3571
248
+ 3572
249
+ 3573
250
+ 3574
251
+ 3575
252
+ 3576
253
+ 3582
254
+ 3583
255
+ 3584
256
+ 3585
257
+ 3711
258
+ 3715
259
+ 3716
260
+ 3718
261
+ 3721
262
+ 3725
263
+ 3731
264
+ 3734
265
+ 3735
266
+ 3741
267
+ 3743
268
+ 3751
269
+ 3754
270
+ 3755
271
+ 3756
272
+ 3757
273
+ 3758
274
+ 3772
275
+ 3773
276
+ 3774
277
+ 3775
278
+ 3777
279
+ 3781
280
+ 3782
281
+ 3786
282
+ 3821
283
+ 3825
284
+ 3826
285
+ 3827
286
+ 3832
287
+ 3835
288
+ 3837
289
+ 3838
290
+ 3841
291
+ 3843
292
+ 3844
293
+ 3845
294
+ 3846
295
+ 3854
296
+ 3855
297
+ 3856
298
+ 3857
299
+ 3858
300
+ 3861
301
+ 3862
302
+ 3863
303
+ 3865
304
+ 3867
305
+ 3868
306
+ 3869
307
+ 3873
308
+ 3876
309
+ 3877
310
+ 3878
311
+ 3885
312
+ 3886
313
+ 3887
314
+ 3888
315
+ 3891
316
+ 3892
317
+ 3894
319
318
  ]
320
319
 
321
320
  # Mobile
@@ -324,8 +323,6 @@ area_codes_4digits = [
324
323
  # landline numbers are. The difference with landline numbers is that a prefix 15, never used for
325
324
  # landlines, must be dialed.
326
325
 
327
-
328
-
329
326
  # International: +54 + 9 + area code + subscriber number (without '15' prefix)
330
327
  # Domestic: area code + 15 + subscriber number
331
328
  # Mobile numbers in Argentina may be listed as 15-xxxxxxx. However, the leading '15'
@@ -340,16 +337,16 @@ special_numbers = [
340
337
  '600', # premium-rate telephone numbers
341
338
  '609', # premium, fixed-rate gaming numbers
342
339
  '610', # dial-up Internet access numbers, usually cheaper than a local call, less frequently used as dial-up Internet access decreased
343
- '605', # premium-rate telephone numbers for charity donations
340
+ '605' # premium-rate telephone numbers for charity donations
344
341
  ]
345
342
 
346
343
  Phony.define do
347
- country '54', trunk('0') |
348
- one_of(area_codes_4digits) >> split(2, 4) | # landline
349
- one_of(area_codes_3digits) >> split(3, 4) | # landline
350
- one_of(area_codes_2digits) >> split(4, 4) | # landline
351
- one_of(area_codes_2digits.map{|x| "9#{x}" }) >> split(4, 4) | # mobile
352
- one_of(area_codes_3digits.map{|x| "9#{x}" }) >> split(3, 4) | # mobile
353
- one_of(area_codes_4digits.map{|x| "9#{x}" }) >> split(2, 4) | # mobile
354
- one_of(special_numbers) >> split(3, 4)
344
+ country '54', trunk('0') |
345
+ one_of(area_codes_4digits) >> split(2, 4) | # landline
346
+ one_of(area_codes_3digits) >> split(3, 4) | # landline
347
+ one_of(area_codes_2digits) >> split(4, 4) | # landline
348
+ one_of(area_codes_2digits.map { |x| "9#{x}" }) >> split(4, 4) | # mobile
349
+ one_of(area_codes_3digits.map { |x| "9#{x}" }) >> split(3, 4) | # mobile
350
+ one_of(area_codes_4digits.map { |x| "9#{x}" }) >> split(2, 4) | # mobile
351
+ one_of(special_numbers) >> split(3, 4)
355
352
  end