phony 2.18.3 → 3.0.3

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.md +117 -0
  3. data/lib/phony/config.rb +25 -26
  4. data/lib/phony/countries/argentina.rb +352 -0
  5. data/lib/phony/countries/austria.rb +73 -74
  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 +93 -93
  9. data/lib/phony/countries/cambodia.rb +10 -14
  10. data/lib/phony/countries/china.rb +22 -18
  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 +10 -9
  18. data/lib/phony/countries/italy.rb +79 -60
  19. data/lib/phony/countries/japan.rb +456 -406
  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 +109 -107
  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 +48 -36
  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 +356 -48
  38. data/lib/phony/countries/taiwan.rb +20 -18
  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 +20 -14
  45. data/lib/phony/countries/zimbabwe.rb +31 -31
  46. data/lib/phony/countries.rb +509 -453
  47. data/lib/phony/country.rb +50 -44
  48. data/lib/phony/country_codes.rb +77 -57
  49. data/lib/phony/dsl.rb +25 -28
  50. data/lib/phony/local_splitters/fixed.rb +24 -29
  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 +8 -14
  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 +23 -23
  60. data/lib/phony/vanity.rb +12 -13
  61. data/lib/phony.rb +84 -83
  62. metadata +14 -45
  63. data/README.textile +0 -112
  64. data/spec/functional/config_spec.rb +0 -44
  65. data/spec/functional/plausibility_spec.rb +0 -608
  66. data/spec/lib/phony/countries_spec.rb +0 -1391
  67. data/spec/lib/phony/country_codes_spec.rb +0 -203
  68. data/spec/lib/phony/country_spec.rb +0 -84
  69. data/spec/lib/phony/dsl_spec.rb +0 -24
  70. data/spec/lib/phony/local_splitters/fixed_spec.rb +0 -56
  71. data/spec/lib/phony/local_splitters/regex_spec.rb +0 -97
  72. data/spec/lib/phony/national_code_spec.rb +0 -91
  73. data/spec/lib/phony/national_splitters/default_spec.rb +0 -34
  74. data/spec/lib/phony/national_splitters/fixed_spec.rb +0 -49
  75. data/spec/lib/phony/national_splitters/none_spec.rb +0 -28
  76. data/spec/lib/phony/national_splitters/regex_spec.rb +0 -23
  77. data/spec/lib/phony/national_splitters/variable_spec.rb +0 -39
  78. data/spec/lib/phony/vanity_spec.rb +0 -30
  79. data/spec/lib/phony_spec.rb +0 -70
@@ -2,78 +2,78 @@
2
2
 
3
3
  # Tajikistan (Republic of)
4
4
 
5
- ndcs_with_6_subscriber_digits = %w(372)
5
+ ndcs_with_6_subscriber_digits = %w[372]
6
6
 
7
- ndcs_with_5_subscriber_digits = %w(
8
- 3130
9
- 3131
10
- 3132
11
- 3133
12
- 3134
13
- 3135
14
- 3136
15
- 3137
16
- 3138
17
- 3139
18
- 3141
19
- 3153
20
- 3154
21
- 3155
22
- 3156
23
- 3222
24
- 3240
25
- 3242
26
- 3243
27
- 3245
28
- 3246
29
- 3247
30
- 3248
31
- 3249
32
- 3250
33
- 3251
34
- 3252
35
- 3311
36
- 3312
37
- 3314
38
- 3315
39
- 3316
40
- 3318
41
- 3322
42
- 3422
43
- 3441
44
- 3442
45
- 3443
46
- 3445
47
- 3451
48
- 3452
49
- 3453
50
- 3454
51
- 3455
52
- 3456
53
- 3462
54
- 3464
55
- 3465
56
- 3467
57
- 3475
58
- 3479
59
- 3522
60
- 3551
61
- 3552
62
- 3553
63
- 3554
64
- 3555
65
- 3556
66
- )
7
+ ndcs_with_5_subscriber_digits = %w[
8
+ 3130
9
+ 3131
10
+ 3132
11
+ 3133
12
+ 3134
13
+ 3135
14
+ 3136
15
+ 3137
16
+ 3138
17
+ 3139
18
+ 3141
19
+ 3153
20
+ 3154
21
+ 3155
22
+ 3156
23
+ 3222
24
+ 3240
25
+ 3242
26
+ 3243
27
+ 3245
28
+ 3246
29
+ 3247
30
+ 3248
31
+ 3249
32
+ 3250
33
+ 3251
34
+ 3252
35
+ 3311
36
+ 3312
37
+ 3314
38
+ 3315
39
+ 3316
40
+ 3318
41
+ 3322
42
+ 3422
43
+ 3441
44
+ 3442
45
+ 3443
46
+ 3445
47
+ 3451
48
+ 3452
49
+ 3453
50
+ 3454
51
+ 3455
52
+ 3456
53
+ 3462
54
+ 3464
55
+ 3465
56
+ 3467
57
+ 3475
58
+ 3479
59
+ 3522
60
+ 3551
61
+ 3552
62
+ 3553
63
+ 3554
64
+ 3555
65
+ 3556
66
+ ]
67
67
 
68
- ndcs_with_3_subscriber_digits = %w(331700)
68
+ ndcs_with_3_subscriber_digits = %w[331700]
69
69
 
70
70
  Phony.define do
71
71
  country '992',
72
- trunk('8') |
73
- one_of(ndcs_with_3_subscriber_digits) >> split(3) |
74
- one_of(ndcs_with_5_subscriber_digits) >> split(3,2) |
75
- one_of(ndcs_with_6_subscriber_digits) >> split(3,3) |
76
- match(/\A(505|9\d\d)\d+\z/) >> split(3,3) | # mobile
77
- one_of(%w(446 474 487)) >> split(3,3) | # wireless geographic
78
- fixed(3) >> split(3,3)
79
- end
72
+ trunk('8') |
73
+ one_of(ndcs_with_3_subscriber_digits) >> split(3) |
74
+ one_of(ndcs_with_5_subscriber_digits) >> split(3, 2) |
75
+ one_of(ndcs_with_6_subscriber_digits) >> split(3, 3) |
76
+ match(/\A(505|9\d\d)\d+\z/) >> split(3, 3) | # mobile
77
+ one_of(%w[446 474 487]) >> split(3, 3) | # wireless geographic
78
+ fixed(3) >> split(3, 3)
79
+ end
@@ -4,73 +4,73 @@
4
4
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
5
5
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=TM
6
6
 
7
- ndcs_with_6_subscriber_digits = %w(12)
7
+ ndcs_with_6_subscriber_digits = %w[12]
8
8
 
9
- ndcs_with_5_subscriber_digits = %w(
10
- 131
11
- 132
12
- 133
13
- 134
14
- 135
15
- 136
16
- 137
17
- 138
18
- 222
19
- 240
20
- 241
21
- 242
22
- 243
23
- 245
24
- 246
25
- 247
26
- 248
27
- 322
28
- 340
29
- 343
30
- 344
31
- 345
32
- 346
33
- 347
34
- 348
35
- 349
36
- 360
37
- 422
38
- 431
39
- 432
40
- 438
41
- 440
42
- 441
43
- 442
44
- 443
45
- 444
46
- 445
47
- 446
48
- 447
49
- 448
50
- 449
51
- 461
52
- 465
53
- 522
54
- 557
55
- 558
56
- 559
57
- 560
58
- 561
59
- 564
60
- 565
61
- 566
62
- 568
63
- 569
64
- )
9
+ ndcs_with_5_subscriber_digits = %w[
10
+ 131
11
+ 132
12
+ 133
13
+ 134
14
+ 135
15
+ 136
16
+ 137
17
+ 138
18
+ 222
19
+ 240
20
+ 241
21
+ 242
22
+ 243
23
+ 245
24
+ 246
25
+ 247
26
+ 248
27
+ 322
28
+ 340
29
+ 343
30
+ 344
31
+ 345
32
+ 346
33
+ 347
34
+ 348
35
+ 349
36
+ 360
37
+ 422
38
+ 431
39
+ 432
40
+ 438
41
+ 440
42
+ 441
43
+ 442
44
+ 443
45
+ 444
46
+ 445
47
+ 446
48
+ 447
49
+ 448
50
+ 449
51
+ 461
52
+ 465
53
+ 522
54
+ 557
55
+ 558
56
+ 559
57
+ 560
58
+ 561
59
+ 564
60
+ 565
61
+ 566
62
+ 568
63
+ 569
64
+ ]
65
65
 
66
- ndcs_with_4_subscriber_digits = %w(1392)
66
+ ndcs_with_4_subscriber_digits = %w[1392]
67
67
 
68
68
  Phony.define do
69
69
  country '993',
70
- trunk('8') |
71
- one_of(ndcs_with_4_subscriber_digits) >> split(4) |
72
- one_of(ndcs_with_5_subscriber_digits) >> split(3,2) |
73
- one_of(ndcs_with_6_subscriber_digits) >> split(3,3) |
74
- one_of('6') >> split(3,4) | # mobile
75
- fixed(3) >> split(3,2)
76
- end
70
+ trunk('8') |
71
+ one_of(ndcs_with_4_subscriber_digits) >> split(4) |
72
+ one_of(ndcs_with_5_subscriber_digits) >> split(3, 2) |
73
+ one_of(ndcs_with_6_subscriber_digits) >> split(3, 3) |
74
+ one_of('6') >> split(3, 4) | # mobile
75
+ fixed(3) >> split(3, 2)
76
+ end