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
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # frozen_string_literal: true
3
2
 
4
3
  # All countries, ordered by country code.
@@ -44,7 +43,6 @@
44
43
  # )
45
44
  #
46
45
  Phony.define do
47
-
48
46
  # Reserved.
49
47
  #
50
48
  reserved '0'
@@ -52,16 +50,16 @@ Phony.define do
52
50
  # USA, Canada, etc.
53
51
  #
54
52
  country '1',
55
- # The US has a delimiter between NDC and local number.
56
- trunk('1%s', normalize: true, format: false) | # http://en.wikipedia.org/wiki/Trunk_prefix
57
- fixed(3) >> split(3,4),
58
- :invalid_ndcs => /[0-1]\d{2}|[3-9]11/,
59
- :parentheses => true,
60
- :local_space => :-
53
+ # The US has a delimiter between NDC and local number.
54
+ trunk('1%s', normalize: true, format: false) | # http://en.wikipedia.org/wiki/Trunk_prefix
55
+ fixed(3) >> split(3, 4),
56
+ invalid_ndcs: /[0-1]\d{2}|[3-9]11/,
57
+ parentheses: true,
58
+ local_space: :-
61
59
 
62
60
  # Kazakhstan (Republic of) & Russsian Federation.
63
61
  # also Abhasia and South Osetia autonomous regions / recognized by some states as independent countries
64
- #country '7', fixed(3) >> split(3,2,2)
62
+ # country '7', fixed(3) >> split(3,2,2)
65
63
  # see special file
66
64
 
67
65
  # Egypt.
@@ -70,26 +68,26 @@ Phony.define do
70
68
  one_of('3') >> split(7..7) | # Alexandria
71
69
  one_of('2') >> split(8..8) | # Cairo/Giza
72
70
  one_of('10', '11', '12', '15') >> split(8..8) | # the 4 mobile operators
73
- fixed(2) >> split(7..7) # all the other 24 provinces
71
+ fixed(2) >> split(7..7) # all the other 24 provinces
74
72
 
75
73
  # South Africa.
76
74
  #
77
- country '27', fixed(2) >> split(3,4)
75
+ country '27', fixed(2) >> split(3, 4)
78
76
 
79
77
  # Greece. http://www.numberingplans.com/?page=dialling&sub=areacodes
80
78
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=GR
81
79
  country '30',
82
- trunk('0') |
83
- one_of(%w(231 241 251 261 271 281)) >> split(3,4) |
84
- one_of('800') >> split(3,4) | # freephone
85
- one_of(%w(801 807)) >> split(3,4) | # shared cost, premium rate
86
- one_of('896') >> split(3,4) | # ISP
87
- one_of(%w(901 909)) >> split(3,4) | # premium rate
88
- one_of(%w(21 22 23 24 25 26 27 28)) >> split(4,4) |
89
- one_of('50') >> split(4,4) | # VPN
90
- match(/^(69\d)\d+$/) >> split(3,4) | # mobile, pager
91
- one_of('70') >> split(4,4) | # universal access
92
- fixed(4) >> split(6) # 3-digit NDCs
80
+ trunk('0') |
81
+ one_of(%w[231 241 251 261 271 281]) >> split(3, 4) |
82
+ one_of('800') >> split(3, 4) | # freephone
83
+ one_of(%w[801 807]) >> split(3, 4) | # shared cost, premium rate
84
+ one_of('896') >> split(3, 4) | # ISP
85
+ one_of(%w[901 909]) >> split(3, 4) | # premium rate
86
+ one_of(%w[21 22 23 24 25 26 27 28]) >> split(4, 4) |
87
+ one_of('50') >> split(4, 4) | # VPN
88
+ match(/^(69\d)\d+$/) >> split(3, 4) | # mobile, pager
89
+ one_of('70') >> split(4, 4) | # universal access
90
+ fixed(4) >> split(6) # 3-digit NDCs
93
91
 
94
92
  # country '31' # Netherlands, see special file.
95
93
 
@@ -99,46 +97,46 @@ Phony.define do
99
97
  # https://www.bipt.be/operators/publication/national-numbering-plan
100
98
  #
101
99
  country '32', trunk('0') |
102
- match(/^(7[08])\d+$/) >> split(3,3) | # Premium and national rate Services
103
- match(/^(800|90\d)\d+$/) >> split(2,3) | # Toll free service and premium numbers
104
- match(/^(46[056789])\d{6}$/) >> split(2,2,2) | # Mobile (Lycamobile, Telenet, Join Experience, Proximus 0460)
105
- match(/^(4[789]\d)\d{6}$/) >> split(2,2,2) | # Mobile
106
- match(/^(45[56])\d{6}$/) >> split(2,2,2) | # Mobile Vikings and Voo
107
- one_of('2','3','4','9') >> split(3,2,2) | # Short NDCs
108
- fixed(2) >> split(2,2,2) # 2-digit NDCs
100
+ match(/^(7[08])\d+$/) >> split(3, 3) | # Premium and national rate Services
101
+ match(/^(800|90\d)\d+$/) >> split(2, 3) | # Toll free service and premium numbers
102
+ match(/^(46[056789])\d{6}$/) >> split(2, 2, 2) | # Mobile (Lycamobile, Telenet, Join Experience, Proximus 0460)
103
+ match(/^(4[789]\d)\d{6}$/) >> split(2, 2, 2) | # Mobile
104
+ match(/^(45[56])\d{6}$/) >> split(2, 2, 2) | # Mobile Vikings and Voo
105
+ one_of('2', '3', '4', '9') >> split(3, 2, 2) | # Short NDCs
106
+ fixed(2) >> split(2, 2, 2) # 2-digit NDCs
109
107
 
110
108
  # France.
111
109
  #
112
110
  country '33',
113
- trunk('0') |
114
- fixed(1) >> split(2,2,2,2) # :service? => /^8.*$/, :mobile? => /^[67].*$/
111
+ trunk('0') |
112
+ fixed(1) >> split(2, 2, 2, 2) # :service? => /^8.*$/, :mobile? => /^[67].*$/
115
113
 
116
114
  # Spain.
117
115
  #
118
116
  # http://www.minetur.gob.es/telecomunicaciones/es-es/servicios/numeracion/paginas/plan.aspx
119
117
  #
120
118
  country '34',
121
- match(/^([67]\d{2})\d+$/) >> split(3,3) | # Mobile
122
- match(/^([89]0\d)\d+$/) >> split(3,3) | # Special 80X & 90X numbers
123
- one_of(%w(91 93)) >> split(3,2,2) | # Landline large regions
124
- match(/^(9\d{2})\d+$/) >> split(2,2,2) | # Landline
125
- fixed(3, :zero => false) >> split(3,3)
119
+ match(/^([67]\d{2})\d+$/) >> split(3, 3) | # Mobile
120
+ match(/^([89]0\d)\d+$/) >> split(3, 3) | # Special 80X & 90X numbers
121
+ one_of(%w[91 93]) >> split(3, 2, 2) | # Landline large regions
122
+ match(/^(9\d{2})\d+$/) >> split(2, 2, 2) | # Landline
123
+ fixed(3, zero: false) >> split(3, 3)
126
124
 
127
125
  # Hungary.
128
126
  #
129
127
  # http://webpub-ext.nmhh.hu/aga/foldr/DoIndexAction.do
130
128
  #
131
129
  country '36',
132
- trunk('06', normalize: false) |
133
- one_of('104', '105', '107', '112') >> split(3,3) | # Service
134
- one_of('1') >> split(3,4) | # Budapest
135
- one_of('20', '30', '31', '50', '70') >> split(3,4) | # Mobile
136
- one_of('21') >> split(3,4) | # VOIP
137
- one_of('40', '80', '90', '91') >> split(3,3) | # Special charged numbers
138
- one_of('51') >> split(3,3) | # Corporate network, M2M
139
- one_of('38') >> split(3,4) | # Corporate network, M2M
140
- one_of('71') >> split(5,5) | # M2M Numbers
141
- fixed(2) >> split(3,3) # Geographic numbers
130
+ trunk('06', normalize: false) |
131
+ one_of('104', '105', '107', '112') >> split(3, 3) | # Service
132
+ one_of('1') >> split(3, 4) | # Budapest
133
+ one_of('20', '30', '31', '50', '70') >> split(3, 4) | # Mobile
134
+ one_of('21') >> split(3, 4) | # VOIP
135
+ one_of('40', '80', '90', '91') >> split(3, 3) | # Special charged numbers
136
+ one_of('51') >> split(3, 3) | # Corporate network, M2M
137
+ one_of('38') >> split(3, 4) | # Corporate network, M2M
138
+ one_of('71') >> split(5, 5) | # M2M Numbers
139
+ fixed(2) >> split(3, 3) # Geographic numbers
142
140
 
143
141
  # country '39' # Italy, see special file.
144
142
 
@@ -146,19 +144,19 @@ Phony.define do
146
144
  #
147
145
  country '40',
148
146
  trunk('0') |
149
- match(/^(112|800|90[036])\d+$/) >> split(3,3) | # Service
150
- match(/^(7[1-9])\d+$/) >> split(3,4) | # Mobile
151
- one_of('21', '31') >> split(3,4) | # Bucureşti
152
- fixed(3) >> split(3,3) # 3-digit NDCs
147
+ match(/^(112|800|90[036])\d+$/) >> split(3, 3) | # Service
148
+ match(/^(7[1-9])\d+$/) >> split(3, 4) | # Mobile
149
+ one_of('21', '31') >> split(3, 4) | # Bucureşti
150
+ fixed(3) >> split(3, 3) # 3-digit NDCs
153
151
 
154
152
  # Switzerland.
155
153
  #
156
154
  country '41',
157
155
  trunk('0', normalize: true) |
158
156
  match(/^(860)\d+$/) >> split(2, 3, 2, 2) | # Voice Mail access
159
- match(/^(8(?:00|4[0248]))\d+$/) >> split(3,3) | # Freecall/Shared Cost
160
- match(/^(90[016])\d+$/) >> split(3,3) | # Business
161
- fixed(2) >> split(3,2,2)
157
+ match(/^(8(?:00|4[0248]))\d+$/) >> split(3, 3) | # Freecall/Shared Cost
158
+ match(/^(90[016])\d+$/) >> split(3, 3) | # Business
159
+ fixed(2) >> split(3, 2, 2)
162
160
 
163
161
  # country '43' # Austria, see special file.
164
162
  # country '44' # UnitedKingdom, see special file.
@@ -166,24 +164,24 @@ Phony.define do
166
164
  # Denmark.
167
165
  #
168
166
  country '45',
169
- none >> split(2,2,2,2..2)
167
+ none >> split(2, 2, 2, 2..2)
170
168
 
171
169
  # country '46' # Sweden, see special file.
172
170
 
173
171
  # Norway.
174
172
  #
175
173
  country '47',
176
- none >> matched_split(/^[1].*$/ => [3],
177
- /^[489].*$/ => [3,2,3],
178
- :fallback => [2,2,2,2])
174
+ none >> matched_split(/^[1].*$/ => [3],
175
+ /^[489].*$/ => [3, 2, 3],
176
+ :fallback => [2, 2, 2, 2])
179
177
 
180
178
  # Poland (Republic of)
181
179
  # Although the NDCs are 2 digits, the representation is 3 digits.
182
180
  # Note: http://wapedia.mobi/en/Telephone_numbers_in_Poland, mobile not yet correct
183
181
  #
184
182
  country '48',
185
- match(/^(45\d|5[0137]\d|6[069]\d|7[02389]\d|80[01]|88\d)/) >> split(3,3) |
186
- fixed(2) >> split(3,2,2)
183
+ match(/^(45\d|5[0137]\d|6[069]\d|7[02389]\d|80[01]|88\d)/) >> split(3, 3) |
184
+ fixed(2) >> split(3, 2, 2)
187
185
 
188
186
  # country '49' # Germany, see special file.
189
187
 
@@ -191,21 +189,21 @@ Phony.define do
191
189
  # Note: https://en.wikipedia.org/wiki/Telephone_numbers_in_Peru
192
190
  # Note: https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=PE
193
191
  country '51',
194
- one_of('103', '105') >> split(3,3) | # Service.
195
- one_of('9') >> split(4,4) | # Mobile.
196
- one_of('1') >> split(3,4) | # Lima.
197
- fixed(2) >> split(3,3) # 2-digit NDCs.
192
+ one_of('103', '105') >> split(3, 3) | # Service.
193
+ one_of('9') >> split(4, 4) | # Mobile.
194
+ one_of('1') >> split(3, 4) | # Lima.
195
+ fixed(2) >> split(3, 3) # 2-digit NDCs.
198
196
 
199
197
  # Mexico.
200
198
  #
201
199
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Mexico
202
200
  # http://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers#Mexico
203
201
  country '52',
204
- match(/^(0\d{1,2})\d{10}$/) >> split(3,3,4) | # prefixed numbers from within Mexico (e.g. 045 + 10 digits or 02 + 10 digits)
205
- match(/^(1)(33|55|81)\d{8}$/) >> split(2,4,4) | # Mexico D.F, Guadalajara, Monterrey cell phone from abroad (e.g. 52 1 55 xxxx xxxx)
206
- match(/^(33|55|81)\d{8}$/) >> split(4,4) | # Mexico D.F, Guadalajara, Monterrey from within Mexico
207
- match(/^(1)(\d{3})\d{7}$/) >> split(3,3,4) | # cell phone from abroad
208
- match(/^(\d{3})\d{7}$/) >> split(3,4) # catchall.
202
+ match(/^(0\d{1,2})\d{10}$/) >> split(3, 3, 4) | # prefixed numbers from within Mexico (e.g. 045 + 10 digits or 02 + 10 digits)
203
+ match(/^(1)(33|55|81)\d{8}$/) >> split(2, 4, 4) | # Mexico D.F, Guadalajara, Monterrey cell phone from abroad (e.g. 52 1 55 xxxx xxxx)
204
+ match(/^(33|55|81)\d{8}$/) >> split(4, 4) | # Mexico D.F, Guadalajara, Monterrey from within Mexico
205
+ match(/^(1)(\d{3})\d{7}$/) >> split(3, 3, 4) | # cell phone from abroad
206
+ match(/^(\d{3})\d{7}$/) >> split(3, 4) # catchall.
209
207
 
210
208
  # Cuba.
211
209
  #
@@ -224,76 +222,75 @@ Phony.define do
224
222
  # Chile.
225
223
  #
226
224
  country '56',
227
- match(/^(13[0-79]|14[79])\d+$/) >> split(3,3) | # Service
228
- one_of('2', '9') >> split(8) | # Santiago, Mobile
229
- fixed(2) >> split(8) # 2-digit NDCs
225
+ match(/^(13[0-79]|14[79])\d+$/) >> split(3, 3) | # Service
226
+ one_of('2', '9') >> split(8) | # Santiago, Mobile
227
+ fixed(2) >> split(8) # 2-digit NDCs
230
228
 
231
229
  # Colombia.
232
230
  # http://www.itu.int/oth/T020200002C/en
233
231
  country '57',
234
- match(/\A(3\d\d)\d+\z/) >> split(3,4) | # mobile (300 310 311 312 313 315 316)
235
- match(/\A(60\d)\d+\z/) >> split(3,4) |
236
- fixed(1) >> split(3,4)
232
+ match(/\A(3\d\d)\d+\z/) >> split(3, 4) | # mobile (300 310 311 312 313 315 316)
233
+ match(/\A(60\d)\d+\z/) >> split(3, 4) |
234
+ fixed(1) >> split(3, 4)
237
235
 
238
236
  # Venezuela (Bolivarian Republic of)
239
237
  #
240
238
  country '58',
241
- fixed(3) >> split(7)
239
+ fixed(3) >> split(7)
242
240
 
243
241
  # country '60' # Malaysia, see special file.
244
242
 
245
243
  # Australia.
246
244
  #
247
245
  country '61',
248
- trunk('0', format: false) |
249
- match(/^(4\d\d)\d+$/) >> split(3,3) | # Mobile
250
- match(/^(1800)\d+$/) >> split(3,3) | # 1800 free call
251
- match(/^(1300)\d+$/) >> split(3,3) | # 1300 local rate
252
- match(/^(13)\d+$/) >> split(2,2) | # 13 local rate
253
- fixed(1) >> split(4,4) # Rest
246
+ trunk('0', format: false) |
247
+ match(/^(4\d\d)\d+$/) >> split(3, 3) | # Mobile
248
+ match(/^(1800)\d+$/) >> split(3, 3) | # 1800 free call
249
+ match(/^(1300)\d+$/) >> split(3, 3) | # 1300 local rate
250
+ match(/^(13)\d+$/) >> split(2, 2) | # 13 local rate
251
+ fixed(1) >> split(4, 4) # Rest
254
252
 
255
- # country '62' # Indonesia (Republic of), see special file
253
+ # country '62' # Indonesia (Republic of), see special file
256
254
 
257
255
  # Philippines (Republic of the)
258
256
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=PH
259
257
  country '63',
260
- trunk('0') |
261
- # 7/10 digits for area code '2'.
262
- match(/\A(2)\d{10}\z/) >> split(10) |
263
- match(/\A(2)\d{8}\z/) >> split(8) |
264
- one_of('2') >> split(7) |
265
- # mobile
266
- match(/\A([89]\d\d)\d{7}\z/) >> split(7) |
267
- match(/\A(9\d\d)\d+\z/) >> split(6) |
268
- #
269
- fixed(2) >> split(7)
258
+ trunk('0') |
259
+ # 7/10 digits for area code '2'.
260
+ match(/\A(2)\d{10}\z/) >> split(10) |
261
+ match(/\A(2)\d{8}\z/) >> split(8) |
262
+ one_of('2') >> split(7) |
263
+ # mobile
264
+ match(/\A([89]\d\d)\d{7}\z/) >> split(7) |
265
+ match(/\A(9\d\d)\d+\z/) >> split(6) |
266
+ fixed(2) >> split(7)
270
267
 
271
268
  # New Zealand.
272
269
  #
273
270
  country '64',
274
- trunk('0') |
275
- match(/^(2\d)\d{7}$/) >> split(3,4) | # Mobile
276
- match(/^(2\d)\d{6}$/) >> split(3,3) |
277
- match(/^(2\d)\d{8}$/) >> split(2,3,3) |
278
- match(/^(800)\d{6}$/) >> split(3,3) | # International 800 service where agreed
279
- match(/^(800)\d{7}$/) >> split(3,4) | # International 800 service where agreed
280
- fixed(1) >> split(3,4) # Rest
271
+ trunk('0') |
272
+ match(/^(2\d)\d{7}$/) >> split(3, 4) | # Mobile
273
+ match(/^(2\d)\d{6}$/) >> split(3, 3) |
274
+ match(/^(2\d)\d{8}$/) >> split(2, 3, 3) |
275
+ match(/^(800)\d{6}$/) >> split(3, 3) | # International 800 service where agreed
276
+ match(/^(800)\d{7}$/) >> split(3, 4) | # International 800 service where agreed
277
+ fixed(1) >> split(3, 4) # Rest
281
278
 
282
279
  # Singapore (Republic of).
283
280
  #
284
281
  country '65',
285
- none >> matched_split(
286
- /^(800)\d{7}$/ => [3,3,4], # International Toll Free Service (ITFS) and Home Country Direct Service (HCDS) Numbers
287
- /^\d{8}$/ => [4,4] # TODO Short Codes
288
- )
282
+ none >> matched_split(
283
+ /^(800)\d{7}$/ => [3, 3, 4], # International Toll Free Service (ITFS) and Home Country Direct Service (HCDS) Numbers
284
+ /^\d{8}$/ => [4, 4] # TODO: Short Codes
285
+ )
289
286
 
290
287
  # Thailand.
291
288
  #
292
289
  country '66',
293
- trunk('0') |
294
- match(/\A([689]\d\d)\d+\z/) >> split(3,3) | # mobile
295
- one_of('2') >> split(3,4) | # Bangkok
296
- fixed(2) >> split(3,3) # Rest
290
+ trunk('0') |
291
+ match(/\A([689]\d\d)\d+\z/) >> split(3, 3) | # mobile
292
+ one_of('2') >> split(3, 4) | # Bangkok
293
+ fixed(2) >> split(3, 3) # Rest
297
294
 
298
295
  # country '81' # Japan, see special file.
299
296
 
@@ -306,8 +303,8 @@ Phony.define do
306
303
  # Turkey.
307
304
  #
308
305
  country '90',
309
- trunk('0') |
310
- fixed(3) >> split(3,4) # Wiki says 7, but the examples say 3, 4.
306
+ trunk('0') |
307
+ fixed(3) >> split(3, 4) # Wiki says 7, but the examples say 3, 4.
311
308
 
312
309
  # country '91' # India (Republic of) see special file
313
310
 
@@ -317,39 +314,39 @@ Phony.define do
317
314
  #
318
315
  # From http://www.wtng.info/wtng-93-af.html
319
316
  #
320
- country '93', fixed(2) >> split(7) # Note: the document says 6, but the examples use 7.
317
+ country '93', fixed(2) >> split(7) # NOTE: the document says 6, but the examples use 7.
321
318
 
322
- country '94', # TODO Sri Lanka (Democratic Socialist Republic of)
323
- fixed(2) >> split(3,2,2)
319
+ country '94', # TODO: Sri Lanka (Democratic Socialist Republic of)
320
+ fixed(2) >> split(3, 2, 2)
324
321
 
325
- #country '95' # Myanmar, see special file.
322
+ # country '95' # Myanmar, see special file.
326
323
 
327
324
  country '98', # Iran (Islamic Republic of)
328
- one_of('21') >> split(4,4) | # Teheran
329
- fixed(3) >> split(3,4)
325
+ one_of('21') >> split(4, 4) | # Teheran
326
+ fixed(3) >> split(3, 4)
330
327
 
331
328
  country '210', todo # -
332
- country '211', fixed(3) >> split(3,3) # South Sudan, http://www.wtng.info/wtng-211-ss.html
329
+ country '211', fixed(3) >> split(3, 3) # South Sudan, http://www.wtng.info/wtng-211-ss.html
333
330
 
334
331
  country '212', # Morocco
335
- trunk('0') |
336
- one_of('6') >> split(2,2,2,2) | # mobile
337
- fixed(2) >> split(4,3)
332
+ trunk('0') |
333
+ one_of('6') >> split(2, 2, 2, 2) | # mobile
334
+ fixed(2) >> split(4, 3)
338
335
 
339
- country '213', fixed(2) >> split(3,4) # Algeria
336
+ country '213', fixed(2) >> split(3, 4) # Algeria
340
337
  country '214', todo # -
341
338
  country '215', todo # -
342
- country '216', fixed(1) >> split(3,4) # Tunisia
339
+ country '216', fixed(1) >> split(3, 4) # Tunisia
343
340
  country '217', todo # -
344
341
 
345
342
  # country '218' # Lybia, see special file
346
343
 
347
344
  country '219', todo # -
348
345
 
349
- country '220', none >> split(3,4) # Gambia http://www.wtng.info/wtng-220-gm.html
350
- country '221', none >> split(4,5) # Senegal http://www.wtng.info/wtng-221-sn.html
351
- country '222', none >> split(4,4) # Mauritania http://www.wtng.info/wtng-222-mr.html
352
- country '223', none >> split(4,4) # Mali http://www.wtng.info/wtng-223-ml.html
346
+ country '220', none >> split(3, 4) # Gambia http://www.wtng.info/wtng-220-gm.html
347
+ country '221', none >> split(4, 5) # Senegal http://www.wtng.info/wtng-221-sn.html
348
+ country '222', none >> split(4, 4) # Mauritania http://www.wtng.info/wtng-222-mr.html
349
+ country '223', none >> split(4, 4) # Mali http://www.wtng.info/wtng-223-ml.html
353
350
 
354
351
  # country '224' # Guinea, see special file
355
352
 
@@ -360,8 +357,8 @@ Phony.define do
360
357
  #
361
358
  # There is no trunk code for this country and several of the mobile prefixes start with 0
362
359
  country '225',
363
- trunk('', :normalize => false) |
364
- fixed(2) >> split(2,2,2,2)
360
+ trunk('', normalize: false) |
361
+ fixed(2) >> split(2, 2, 2, 2)
365
362
 
366
363
  # Burkina Faso
367
364
  # http://www.wtng.info/wtng-226-bf.html
@@ -369,12 +366,21 @@ Phony.define do
369
366
  #
370
367
  # There is no trunk code for this country and several of the mobile prefixes start with 0
371
368
  country '226',
372
- trunk('', normalize: false) |
373
- none >> split(2,2,2,2)
369
+ trunk('', normalize: false) |
370
+ none >> split(2, 2, 2, 2)
374
371
 
375
- country '227', none >> split(4,4) # Niger http://www.wtng.info/wtng-227-ne.html
376
- country '228', none >> split(4,4) # Togolese Republic http://www.wtng.info/wtng-228-tg.html
377
- country '229', none >> split(4,4) # Benin http://www.itu.int/oth/T0202000017/en
372
+ country '227', none >> split(4, 4) # Niger http://www.wtng.info/wtng-227-ne.html
373
+ country '228', none >> split(4, 4) # Togolese Republic http://www.wtng.info/wtng-228-tg.html
374
+
375
+ # Benin http://www.itu.int/oth/T0202000017/en
376
+ #
377
+ # There is no trunk code for this country and prefixes start with 0
378
+ country '229',
379
+ trunk('', normalize: false) |
380
+ none >> matched_split(
381
+ # Old empty and new 01 prefix.
382
+ /\A(01)?\d+\z/ => [2, 2, 2, 2, 2]
383
+ )
378
384
 
379
385
  # Mauritius
380
386
  # http://www.wtng.info/wtng-230-mu.html
@@ -382,21 +388,21 @@ Phony.define do
382
388
  #
383
389
  # There is no trunk code for this country.
384
390
  country '230',
385
- none >> matched_split(
386
- /^5\d{7}$/ => [1,3,4], # Mobile
387
- /^[246]\d{6}$/ => [3,4], # Landline
388
- )
391
+ none >> matched_split(
392
+ /^5\d{7}$/ => [1, 3, 4], # Mobile
393
+ /^[246]\d{6}$/ => [3, 4] # Landline
394
+ )
389
395
 
390
396
  # Liberia
391
397
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=LR
392
398
  country '231',
393
- none >> matched_split(
394
- /\A[23]\d+\z/ => [4,4], # LIBTELCO, TEMAS
395
- /\A[4568]\d+\z/ => [4,3], # mobile Lonestar, Libercell, Comium Liberia Inc.
396
- /\A77\d+\z/ => [2,3,4], # http://monrovia.usembassy.gov/contact.html
397
- /\A7\d+\z/ => [4,4], # mobile Cellcom
398
- /\A9\d+\z/ => [4,4], # premium rate Telelinks International SAL, Interactive Media Corporation
399
- )
399
+ none >> matched_split(
400
+ /\A[23]\d+\z/ => [4, 4], # LIBTELCO, TEMAS
401
+ /\A[4568]\d+\z/ => [4, 3], # mobile Lonestar, Libercell, Comium Liberia Inc.
402
+ /\A77\d+\z/ => [2, 3, 4], # http://monrovia.usembassy.gov/contact.html
403
+ /\A7\d+\z/ => [4, 4], # mobile Cellcom
404
+ /\A9\d+\z/ => [4, 4] # premium rate Telelinks International SAL, Interactive Media Corporation
405
+ )
400
406
 
401
407
  country '232', fixed(2) >> split(3, 3) # Sierra Leone http://www.wtng.info/wtng-232-sl.html
402
408
 
@@ -405,7 +411,7 @@ Phony.define do
405
411
  # From http://www.itu.int/oth/T0202000052/en
406
412
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Ghana
407
413
  #
408
- country '233', trunk('0') | fixed(2) >> split(3,4)
414
+ country '233', trunk('0') | fixed(2) >> split(3, 4)
409
415
 
410
416
  # Nigeria
411
417
  # 3 4 split for mobile and 1 digit NDC, 3 2 or 3 3 otherwise
@@ -415,46 +421,46 @@ Phony.define do
415
421
  # https://www.ncc.gov.ng/technical-regulation/standards/numbering and
416
422
  # https://www.itu.int/oth/T020200009C/en
417
423
  country '234',
418
- match(/^([7-9]0\d)\d+$/) >> split(3,4) | # Mobile
419
- match(/^(81\d)\d+$/) >> split(3,4) | # Mobile
420
- match(/^(91\d)\d+$/) >> split(3,4) | # Mobile
421
- one_of('1', '2') >> split(3,3..4) | # Lagos, Ibadan
422
- one_of('9') >> split(3,4) | # Abuja
423
- one_of((30..79).map(&:to_s)) >> split(3,2..3) | # 2-digit NDC
424
- one_of(%w(82 83 84 85 86 87 88 89)) >> split(3,3) # 2-digit NDC
425
-
426
- country '235', none >> split(4,4) # Chad http://www.wtng.info/wtng-235-td.html
427
- country '236', none >> split(4,4) # Central African Republic http://www.wtng.info/wtng-236-cf.html
428
- country '237', none >> split(3,2,2,2) # Cameroon http://www.wtng.info/wtng-237-cm.html
429
- country '238', none >> split(3,4) # Cape Verde http://www.wtng.info/wtng-238-cv.html
430
- country '239', fixed(1) >> split(3,3) # Sao Tome and Principe, http://www.wtng.info/wtng-239-st.html
431
-
432
- country '240', none >> split(3,3,3) # Equatorial Guinea
424
+ match(/^([7-9]0\d)\d+$/) >> split(3, 4) | # Mobile
425
+ match(/^(81\d)\d+$/) >> split(3, 4) | # Mobile
426
+ match(/^(91\d)\d+$/) >> split(3, 4) | # Mobile
427
+ one_of('1', '2') >> split(3, 3..4) | # Lagos, Ibadan
428
+ one_of('9') >> split(3, 4) | # Abuja
429
+ one_of((30..79).map(&:to_s)) >> split(3, 2..3) | # 2-digit NDC
430
+ one_of(%w[82 83 84 85 86 87 88 89]) >> split(3, 3) # 2-digit NDC
431
+
432
+ country '235', none >> split(4, 4) # Chad http://www.wtng.info/wtng-235-td.html
433
+ country '236', none >> split(4, 4) # Central African Republic http://www.wtng.info/wtng-236-cf.html
434
+ country '237', none >> split(3, 2, 2, 2) # Cameroon http://www.wtng.info/wtng-237-cm.html
435
+ country '238', none >> split(3, 4) # Cape Verde http://www.wtng.info/wtng-238-cv.html
436
+ country '239', fixed(1) >> split(3, 3) # Sao Tome and Principe, http://www.wtng.info/wtng-239-st.html
437
+
438
+ country '240', none >> split(3, 3, 3) # Equatorial Guinea
433
439
  country '241',
434
- match(/^(\d)\d{6}$/) >> split(3,3) | # Gabonese Republic http://www.wtng.info/wtng-241-ga.html
435
- match(/^(\d\d)\d{6}$/) >> split(2,2,2) # 2019 update https://en.wikipedia.org/wiki/Telephone_numbers_in_Gabon
440
+ match(/^(\d)\d{6}$/) >> split(3, 3) | # Gabonese Republic http://www.wtng.info/wtng-241-ga.html
441
+ match(/^(\d\d)\d{6}$/) >> split(2, 2, 2) # 2019 update https://en.wikipedia.org/wiki/Telephone_numbers_in_Gabon
436
442
  country '242', # Congo http://www.wtng.info/wtng-242-cg.html
437
- trunk('', :normalize => false) |
438
- none >> split(4,5)
439
- country '243', fixed(2) >> split(3,4) # Democratic Republic of the Congo http://www.wtng.info/wtng-243-cd.html
440
- country '244', one_of('321', '348', '358', '363', '364', '485', '526', '535', '546', '612', '643', '652', '655', '722', '726', '728', '729', '777') >> split(3,3) | # Angola
441
- fixed(2) >> split(3,4)
442
- country '245', none >> split(2,3,4) # Guinea-Bissau http://www.wtng.info/wtng-245-gw.html
443
- country '246', none >> split(3,4) # Diego Garcia http://www.wtng.info/wtng-246-io.html
443
+ trunk('', normalize: false) |
444
+ none >> split(4, 5)
445
+ country '243', fixed(2) >> split(3, 4) # Democratic Republic of the Congo http://www.wtng.info/wtng-243-cd.html
446
+ country '244', one_of('321', '348', '358', '363', '364', '485', '526', '535', '546', '612', '643', '652', '655', '722', '726', '728', '729', '777') >> split(3, 3) | # Angola
447
+ fixed(2) >> split(3, 4)
448
+ country '245', none >> split(2, 3, 4) # Guinea-Bissau http://www.wtng.info/wtng-245-gw.html
449
+ country '246', none >> split(3, 4) # Diego Garcia http://www.wtng.info/wtng-246-io.html
444
450
  country '247', none >> split(4) # Ascension
445
451
 
446
- country '248', # Seychelles
447
- fixed(1) >> split(2,2,2)
452
+ country '248', # Seychelles
453
+ fixed(1) >> split(2, 2, 2)
448
454
 
449
- country '249', fixed(2) >> split(3,4) # Sudan
455
+ country '249', fixed(2) >> split(3, 4) # Sudan
450
456
 
451
457
  # Rwanda
452
458
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Rwanda
453
459
  country '250',
454
- trunk('0') |
455
- one_of('25') >> split(7) | # Geographic, fixed
456
- match(/^(7[2389])/) >> split(7) | # Non-geographic, mobile
457
- one_of('06') >> split(6) # Satellite
460
+ trunk('0') |
461
+ one_of('25') >> split(7) | # Geographic, fixed
462
+ match(/^(7[2389])/) >> split(7) | # Non-geographic, mobile
463
+ one_of('06') >> split(6) # Satellite
458
464
 
459
465
  country '251', fixed(2) >> split(3, 4) # Ethiopia http://www.wtng.info/wtng-251-et.html
460
466
 
@@ -465,40 +471,40 @@ Phony.define do
465
471
  # Kenya
466
472
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Kenya
467
473
  country '254',
468
- trunk('0') |
469
- match(/^(7\d\d)/) >> split(6) | # mobile
470
- fixed(2) >> split(7) # landline
474
+ trunk('0') |
475
+ match(/^(7\d\d)/) >> split(6) | # mobile
476
+ fixed(2) >> split(7) # landline
471
477
 
472
478
  # Tanzania.
473
479
  #
474
480
  country '255',
475
- trunk('0') |
476
- match(/^([89]\d\d)/) >> split(3,3) | # Special/Premium.
477
- one_of('112', '118') >> split(3,3) | # Short Codes.
478
- fixed(2) >> split(3,4) # Geographic.
481
+ trunk('0') |
482
+ match(/^([89]\d\d)/) >> split(3, 3) | # Special/Premium.
483
+ one_of('112', '118') >> split(3, 3) | # Short Codes.
484
+ fixed(2) >> split(3, 4) # Geographic.
479
485
 
480
486
  # Uganda.
481
487
  #
482
488
  country '256',
483
- match(/^(46[45]|4[78]\d)/) >> split(6) | # Geo 1.
484
- fixed(2) >> split(7) # Geo 2.
489
+ match(/^(46[45]|4[78]\d)/) >> split(6) | # Geo 1.
490
+ fixed(2) >> split(7) # Geo 2.
485
491
 
486
- country '257', none >> split(4,4) # Burundi http://www.wtng.info/wtng-257-bi.html
492
+ country '257', none >> split(4, 4) # Burundi http://www.wtng.info/wtng-257-bi.html
487
493
 
488
494
  # Mozambique, https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=MZ
489
495
  country '258',
490
- one_of('600') >> split(3,3) | # audiotext
491
- one_of('610') >> split(3,3) | # ISP
492
- one_of('800') >> split(3,3) | # freephone
493
- one_of('801') >> split(3,3) | # local rate
494
- one_of('802') >> split(3,3) | # national rate
495
- one_of(%w(251 252 271 272 281 282 293)) >> split(3,2) |
496
- one_of(%w(21 23 24 26)) >> split(3,3) |
497
- one_of(%w(82 83 84 85 86 87)) >> split(4,3) | # mobile
498
- one_of('89') >> split(4,3) | # satellite GMPCS
499
- one_of('7') >> split(4,4) | # universal access
500
- one_of('9') >> split(4,4) | # premium rate
501
- fixed(2) >> split(3,3)
496
+ one_of('600') >> split(3, 3) | # audiotext
497
+ one_of('610') >> split(3, 3) | # ISP
498
+ one_of('800') >> split(3, 3) | # freephone
499
+ one_of('801') >> split(3, 3) | # local rate
500
+ one_of('802') >> split(3, 3) | # national rate
501
+ one_of(%w[251 252 271 272 281 282 293]) >> split(3, 2) |
502
+ one_of(%w[21 23 24 26]) >> split(3, 3) |
503
+ one_of(%w[82 83 84 85 86 87]) >> split(4, 3) | # mobile
504
+ one_of('89') >> split(4, 3) | # satellite GMPCS
505
+ one_of('7') >> split(4, 4) | # universal access
506
+ one_of('9') >> split(4, 4) | # premium rate
507
+ fixed(2) >> split(3, 3)
502
508
 
503
509
  country '259', todo # -
504
510
 
@@ -508,26 +514,26 @@ Phony.define do
508
514
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Zambia
509
515
 
510
516
  country '260',
511
- trunk('0') |
512
- match(/^(75|76|77|94|95|96|97)/) >> split(3, 4) | # Mobile
513
- match(/^(800)/) >> split(3,3) | # Toll free
514
- match(/^(21[1-8])/) >> split(6) # Fixed
517
+ trunk('0') |
518
+ match(/^(75|76|77|94|95|96|97)/) >> split(3, 4) | # Mobile
519
+ match(/^(800)/) >> split(3, 3) | # Toll free
520
+ match(/^(21[1-8])/) >> split(6) # Fixed
515
521
 
516
522
  # Madagascar
517
523
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Madagascar
518
524
  # http://www.itu.int/oth/T020200007F/en
519
525
  country '261',
520
- match(/\A(20)\d+\z/) >> split(2,3,2) | # fix Telecom Malagasy (Telma)
521
- match(/\A(32)\d+\z/) >> split(2,3,2) | # mobile Orange Madagascar
522
- match(/\A(33)\d+\z/) >> split(2,3,2) | # mobile Airtel Madagascar
523
- match(/\A(34)\d+\z/) >> split(2,3,2) | # mobile Telecom Malagasy (Telma)
524
- match(/\A(37)\d+\z/) >> split(2,3,2) | # mobile Orange Madagascar
525
- match(/\A(38)\d+\z/) >> split(2,3,2) | # mobile Telecom Malagasy (Telma)
526
- match(/\A(39)\d+\z/) >> split(2,3,2) # mobile Blueline Madagascar
526
+ match(/\A(20)\d+\z/) >> split(2, 3, 2) | # fix Telecom Malagasy (Telma)
527
+ match(/\A(32)\d+\z/) >> split(2, 3, 2) | # mobile Orange Madagascar
528
+ match(/\A(33)\d+\z/) >> split(2, 3, 2) | # mobile Airtel Madagascar
529
+ match(/\A(34)\d+\z/) >> split(2, 3, 2) | # mobile Telecom Malagasy (Telma)
530
+ match(/\A(37)\d+\z/) >> split(2, 3, 2) | # mobile Orange Madagascar
531
+ match(/\A(38)\d+\z/) >> split(2, 3, 2) | # mobile Telecom Malagasy (Telma)
532
+ match(/\A(39)\d+\z/) >> split(2, 3, 2) # mobile Blueline Madagascar
527
533
 
528
534
  country '262', # Reunion / Mayotte (new) http://www.wtng.info/wtng-262-fr.html
529
- trunk('0') |
530
- fixed(3) >> split(2,2,2)
535
+ trunk('0') |
536
+ fixed(3) >> split(2, 2, 2)
531
537
 
532
538
  # country '263' # Zimbabwe, see special file
533
539
 
@@ -537,10 +543,10 @@ Phony.define do
537
543
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=MW
538
544
  country '265',
539
545
  none >> matched_split(
540
- /\A(21|77)\d+\z/ => [3,3,3], # geographic, mobile
541
- /\A(88|99)\d{7}\z/ => [3,3,3], # mobile
542
- /\A18(00|11|18|20)\z/ => [4], # ISP
543
- /\A\d+\z/ => [4,3]
546
+ /\A(21|77)\d+\z/ => [3, 3, 3], # geographic, mobile
547
+ /\A(88|99)\d{7}\z/ => [3, 3, 3], # mobile
548
+ /\A18(00|11|18|20)\z/ => [4], # ISP
549
+ /\A\d+\z/ => [4, 3]
544
550
  )
545
551
 
546
552
  country '266', none >> split(4, 4) # Lesotho http://www.wtng.info/wtng-266-ls.html
@@ -549,39 +555,39 @@ Phony.define do
549
555
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
550
556
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=BW
551
557
  country '267',
552
- one_of(%w(463 495 499 590)) >> split(4) |
553
- one_of(%w(24 26 29 31 46 47 49 53 54 57 58 59 62 65 68)) >> split(3,2) |
554
- one_of('79') >> split(3,3) | # VoIP telephony
555
- one_of('80') >> split(3,3) | # freephone
556
- one_of('90') >> split(3,3) | # premium rate
557
- one_of('7') >> split(4,3) | # moblie
558
- one_of('8') >> split(4,3) | # shared cost
559
- one_of('3') >> split(3,3) |
560
- fixed(2) >> split(3,2)
558
+ one_of(%w[463 495 499 590]) >> split(4) |
559
+ one_of(%w[24 26 29 31 46 47 49 53 54 57 58 59 62 65 68]) >> split(3, 2) |
560
+ one_of('79') >> split(3, 3) | # VoIP telephony
561
+ one_of('80') >> split(3, 3) | # freephone
562
+ one_of('90') >> split(3, 3) | # premium rate
563
+ one_of('7') >> split(4, 3) | # moblie
564
+ one_of('8') >> split(4, 3) | # shared cost
565
+ one_of('3') >> split(3, 3) |
566
+ fixed(2) >> split(3, 2)
561
567
 
562
568
  # Swaziland http://www.wtng.info/wtng-268-sz.html
563
569
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=SZ
564
570
  country '268',
565
571
  none >> matched_split(
566
- /\A08\d+\z/ => [4,3], # freephone
567
- /\A(2200|2300|2538|2548)\d+\z/ => [4,4], # VoIP telephony Swaziland Posts and Telecommunications Corporation (SPTC)
568
- /\A(2400|76)\d+\z/ => [4,4], # mobile Swazi MTN Ltd
569
- /\A(2550|2551)\d+\z/ => [4,4], # wireless geographic Swaziland Posts and Telecommunications Corporation (SPTC)
570
- /\A(550|551)\d+\z/ => [3,4], # wireless geographic Swaziland Posts and Telecommunications Corporation (SPTC)
571
- /\A(22|23|24|25)\d+\z/ => [4,4], # geographic SPTC
572
- /\A77\d+\z/ => [4,4], # mobile Swaziland Posts and Telecommunications Corporation (SPTC) (CDMA)
573
- /\A78\d+\z/ => [4,4], # mobile Swazi MTN Ltd
572
+ /\A08\d+\z/ => [4, 3], # freephone
573
+ /\A(2200|2300|2538|2548)\d+\z/ => [4, 4], # VoIP telephony Swaziland Posts and Telecommunications Corporation (SPTC)
574
+ /\A(2400|76)\d+\z/ => [4, 4], # mobile Swazi MTN Ltd
575
+ /\A(2550|2551)\d+\z/ => [4, 4], # wireless geographic Swaziland Posts and Telecommunications Corporation (SPTC)
576
+ /\A(550|551)\d+\z/ => [3, 4], # wireless geographic Swaziland Posts and Telecommunications Corporation (SPTC)
577
+ /\A(22|23|24|25)\d+\z/ => [4, 4], # geographic SPTC
578
+ /\A77\d+\z/ => [4, 4], # mobile Swaziland Posts and Telecommunications Corporation (SPTC) (CDMA)
579
+ /\A78\d+\z/ => [4, 4] # mobile Swazi MTN Ltd
574
580
  )
575
581
 
576
582
  # Comoros http://www.wtng.info/wtng-269-km.html
577
583
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=KM
578
584
  country '269',
579
585
  none >> matched_split(
580
- /\A800\d+\z/ => [4,3,3], # freephone Toll-free Global269
581
- /\A(763|77)\d+\z/ => [4,3], # geographic Comores Télécom
582
- /\A(32|33|34)\d+\z/ => [4,3], # mobile Comores Télécom (HURI)
583
- /\A(390|391|900|910)\d+\z/ => [4,3], # premium rate WIAIR SARL
584
- /\A(76)\d+\z/ => [4,3] # wireless geographic Comores Télécom
586
+ /\A800\d+\z/ => [4, 3, 3], # freephone Toll-free Global269
587
+ /\A(763|77)\d+\z/ => [4, 3], # geographic Comores Télécom
588
+ /\A(32|33|34)\d+\z/ => [4, 3], # mobile Comores Télécom (HURI)
589
+ /\A(390|391|900|910)\d+\z/ => [4, 3], # premium rate WIAIR SARL
590
+ /\A(76)\d+\z/ => [4, 3] # wireless geographic Comores Télécom
585
591
  )
586
592
 
587
593
  country '280', todo # -
@@ -611,20 +617,20 @@ Phony.define do
611
617
  # Faroe Islands http://www.wtng.info/wtng-298-fo.html
612
618
  country '298',
613
619
  none >> matched_split(
614
- /\A1\d+\z/ => [4], # universal access: Føroya Tele; ISP: Kall, Føroya Tele
615
- /\A\d+\z/ => [3,3]
620
+ /\A1\d+\z/ => [4], # universal access: Føroya Tele; ISP: Kall, Føroya Tele
621
+ /\A\d+\z/ => [3, 3]
616
622
  )
617
623
 
618
624
  # Greenland http://www.wtng.info/wtng-299-gl.html
619
625
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
620
626
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=GL
621
627
  country '299',
622
- one_of(%w(199 691)) >> split(3) | # satellite; geographic: Ivittuut
623
- one_of(%w(31 32 33 34 35 36 61 64 66 68 81 84 85 86 87 89 91 92 94 95 96 97 98 99)) >> split(4) | # geographic
624
- one_of(%w(22 23 24 25 26 27 28 29 42 43 44 45 46 47 48 49 52 53 54 55 56 57 58 59)) >> split(4) | # mobile: Tele Greenland A/S
625
- one_of(%w(38 39)) >> split(4) | # VoIP telephony
626
- match(/\A(50)\d{4}\z/) >> split(4) | #| voicemail (mobile) Tele Greenland A/S
627
- match(/\A(50)\d{6}\z/) >> split(3,3) | #|
628
+ one_of(%w[199 691]) >> split(3) | # satellite; geographic: Ivittuut
629
+ one_of(%w[31 32 33 34 35 36 61 64 66 68 81 84 85 86 87 89 91 92 94 95 96 97 98 99]) >> split(4) | # geographic
630
+ one_of(%w[22 23 24 25 26 27 28 29 42 43 44 45 46 47 48 49 52 53 54 55 56 57 58 59]) >> split(4) | # mobile: Tele Greenland A/S
631
+ one_of(%w[38 39]) >> split(4) | # VoIP telephony
632
+ match(/\A(50)\d{4}\z/) >> split(4) | # | voicemail (mobile) Tele Greenland A/S
633
+ match(/\A(50)\d{6}\z/) >> split(3, 3) | # |
628
634
  fixed(2) >> split(4)
629
635
 
630
636
  # Gibraltar
@@ -636,36 +642,36 @@ Phony.define do
636
642
  # Portugal.
637
643
  #
638
644
  country '351',
639
- match(/^([78]\d\d)\d+$/) >> split(3,3) | # Service.
640
- match(/^(9\d)\d+$/) >> split(3,4) | # Mobile.
641
- one_of('21', '22') >> split(3,4) | # Lisboa & Porto
642
- fixed(3) >> split(3,3) # 3-digit NDCs
645
+ match(/^([78]\d\d)\d+$/) >> split(3, 3) | # Service.
646
+ match(/^(9\d)\d+$/) >> split(3, 4) | # Mobile.
647
+ one_of('21', '22') >> split(3, 4) | # Lisboa & Porto
648
+ fixed(3) >> split(3, 3) # 3-digit NDCs
643
649
 
644
650
  # Luxembourg
645
651
  #
646
652
  country '352',
647
- match(/^(2[467]\d{2})\d{4}$/) >> split(2,2) | # 4-digit NDC
648
- match(/^(6\d[18])\d+$/) >> split(3,3) | # mobile
649
- match(/^(60\d{2})\d{8}$/) >> split(2,2,2,2) | # mobile machine to machine
650
- match(/^((2[^467]|[2-9]\d))\d{4}$/) >> split(2,2) | # 2-digit NDC Regular 6 digits number
651
- match(/^((2[^467]|[2-9]\d))\d{4}$/) >> split(2,2) | # 2-digit NDC Regular 6 digits number
652
- match(/^((2[^467]|[2-9]\d))\d{5}$/) >> split(2,2,1) | # 2-digit NDC Regular 6 digits number w/ 1 digit extension
653
- match(/^((2[^467]|[2-9]\d))\d{6}$/) >> split(2,2,2) | # 2-digit NDC Regular 8 digits number or 6 digits with 2 digits extension
654
- match(/^((2[^467]|[2-9]\d))\d{7}$/) >> split(2,2,3) | # 2-digit NDC Regular 6 digits with 4 digits extension
655
- match(/^((2[^467]|[2-9]\d))\d{8}$/) >> split(2,2,4) | # 2-digit NDC Regular 6 digits number with 4 digits extension
656
- match(/^(\d{2})\d{3}$/) >> split(2,2,1) # fallback for 5 digit number
653
+ match(/^(2[467]\d{2})\d{4}$/) >> split(2, 2) | # 4-digit NDC
654
+ match(/^(6\d[18])\d+$/) >> split(3, 3) | # mobile
655
+ match(/^(60\d{2})\d{8}$/) >> split(2, 2, 2, 2) | # mobile machine to machine
656
+ match(/^((2[^467]|[2-9]\d))\d{4}$/) >> split(2, 2) | # 2-digit NDC Regular 6 digits number
657
+ match(/^((2[^467]|[2-9]\d))\d{4}$/) >> split(2, 2) | # 2-digit NDC Regular 6 digits number
658
+ match(/^((2[^467]|[2-9]\d))\d{5}$/) >> split(2, 2, 1) | # 2-digit NDC Regular 6 digits number w/ 1 digit extension
659
+ match(/^((2[^467]|[2-9]\d))\d{6}$/) >> split(2, 2, 2) | # 2-digit NDC Regular 8 digits number or 6 digits with 2 digits extension
660
+ match(/^((2[^467]|[2-9]\d))\d{7}$/) >> split(2, 2, 3) | # 2-digit NDC Regular 6 digits with 4 digits extension
661
+ match(/^((2[^467]|[2-9]\d))\d{8}$/) >> split(2, 2, 4) | # 2-digit NDC Regular 6 digits number with 4 digits extension
662
+ match(/^(\d{2})\d{3}$/) >> split(2, 2, 1) # fallback for 5 digit number
657
663
 
658
664
  # country '353' # Republic of Ireland, see special file.
659
665
 
660
- country '354', none >> split(3,4) # Iceland
666
+ country '354', none >> split(3, 4) # Iceland
661
667
 
662
668
  # Albania
663
669
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Albania
664
670
  country '355', trunk('0') |
665
- one_of('4') >> split(3,4) | # Tirana
666
- match(/\A(6[6-9])\d*\z/) >> split(3,4) | # mobile
667
- match(/\A(2[24]|3[2-5]|47|5[2-5]|6[6-9]|8[2-5])\d*\z/) >> split(3,3) |
668
- fixed(3) >> split(3,2)
671
+ one_of('4') >> split(3, 4) | # Tirana
672
+ match(/\A(6[6-9])\d*\z/) >> split(3, 4) | # mobile
673
+ match(/\A(2[24]|3[2-5]|47|5[2-5]|6[6-9]|8[2-5])\d*\z/) >> split(3, 3) |
674
+ fixed(3) >> split(3, 2)
669
675
 
670
676
  # Malta
671
677
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Malta
@@ -677,8 +683,8 @@ Phony.define do
677
683
  # Cyprus
678
684
  # http://www.cytaglobal.com/cytaglobal/userfiles/NewNumberingPlan.pdf
679
685
  country '357', trunk('0') |
680
- one_of('121','122','123') >> split(2,6) | # voicemail
681
- fixed(2) >> split(6) # fixed & mobile
686
+ one_of('121', '122', '123') >> split(2, 6) | # voicemail
687
+ fixed(2) >> split(6) # fixed & mobile
682
688
 
683
689
  # Finland
684
690
  #
@@ -689,9 +695,9 @@ Phony.define do
689
695
  match(/^(73[0-4]\d\d)\d{5}$/) >> split(5) | # national subscriber numbers, 5-digit NDC (starting with 073)
690
696
  match(/^(202[023]|209[8-9]|600[0126-9]|700[0126]|7099|800\d)\d{4,5}$/) >> split(2, 2..3) | # national service numbers, 4-digit NDCs
691
697
  match(/^(606\d|70[78]\d)\d{6}$/) >> split(3, 3) | # national service numbers, 4-digit NDCs (starting with 0606/0707/0708)
692
- match(/^(202[14-9]|209[0-7])\d{4,6}$/) >> split(3, 1..3) | # national subscriber numbers, 4-digit NDCs
698
+ match(/^(202[14-9]|209[0-7])\d{4,6}$/) >> split(3, 1..3) | # national subscriber numbers, 4-digit NDCs
693
699
  match(/^(45[45789]\d)\d{2,6}$/) >> split(2, 0..4) | # mobile numbers, 4-digit NDCs
694
- match(/^([123]00|602)\d{5,6}$/) >> split(3, 2..3) | # national service numbers, 3-digit NDCs
700
+ match(/^([123]00|602)\d{5,6}$/) >> split(3, 2..3) | # national service numbers, 3-digit NDCs
695
701
  match(/^(10[1-9]|20[13-8]|30[1-9]|73[5-9])\d{5,7}$/) >> split(3, 2..4) | # national subscriber numbers, 3-digit NDCs
696
702
  match(/^(71\d)\d{6}$/) >> split(3, 3) | # national subscriber numbers, 3-digit NDCs (starting with 071)
697
703
  match(/^(73[5-9])\d{7}$/) >> split(3, 4) | # national subscriber numbers, 3-digit NDCs (starting with 073)
@@ -699,8 +705,8 @@ Phony.define do
699
705
  match(/^(49\d)\d{8}$/) >> split(3, 3, 2) | # mobile numbers, 3-digit NDCs (starting with 049)
700
706
  match(/^([235]9)\d{6,8}$/) >> split(3, 3, 0..2) | # national subscriber numbers, 2-digit NDCs
701
707
  match(/^(4[0124678]|50)\d{4,8}$/) >> split(3, 1..5) | # mobile numbers, 2-digit NDCs
702
- one_of('2','3','5','6','8','9') >> split(3,1..5) | # Short NDCs
703
- fixed(2) >> split(3, 0..4) # 2-digit NDCs
708
+ one_of('2', '3', '5', '6', '8', '9') >> split(3, 1..5) | # Short NDCs
709
+ fixed(2) >> split(3, 0..4) # 2-digit NDCs
704
710
 
705
711
  # Bulgaria
706
712
  #
@@ -708,34 +714,30 @@ Phony.define do
708
714
  # Note: https://en.wikipedia.org/wiki/Telephone_numbers_in_Bulgaria
709
715
  country '359',
710
716
  trunk('0') |
711
- match(/^(2)\d{6}$/) >> split(3,3) | # Landline Sofia (optional last digit)
712
- match(/^(2)\d{7}$/) >> split(3,4) | # Landline Sofia (optional last digit)
717
+ match(/^(2)\d{6}$/) >> split(3, 3) | # Landline Sofia (optional last digit)
718
+ match(/^(2)\d{7}$/) >> split(3, 4) | # Landline Sofia (optional last digit)
713
719
  match(/^(30|31|33|36|37|39|41|43\d|45|47|51|53|55|57|59)\d{5}$/) >> split(5) |
714
- match(/^(30|31|32|33|34|35|36|37|38|39|41|42|44|45|46|47|51|52|53|54|55|56|57|58|59)\d{6}$/) >> split(2,4) |
715
-
720
+ match(/^(30|31|32|33|34|35|36|37|38|39|41|42|44|45|46|47|51|52|53|54|55|56|57|58|59)\d{6}$/) >> split(2, 4) |
716
721
  match(/^(60|61|63|65|66|69)\d{5}$/) >> split(5) |
717
722
  match(/^(60|61|62|63|64|65|66|68|69)\d{6}$/) >> split(6) |
718
-
719
723
  match(/^(700|701|703|704|705|706|707|708|709)\d{5}$/) >> split(5) |
720
724
  match(/^(701|702|703|704|705|706|707|708|709)\d{4}$/) >> split(4) |
721
-
722
725
  match(/^(71|72|74|75|77)\d{5}$/) >> split(5) |
723
726
  match(/^(71|72|73|74|75|76|77|78|79)\d{6}$/) >> split(6) |
724
-
725
727
  match(/^(80\d|81|91|93|95|97)\d{5}$/) >> split(5) |
726
728
  match(/^(81|82|84|86)\d{6}$/) >> split(6) |
727
- match(/^(87|88|89)\d{7}$/) >> split(4,3) |
729
+ match(/^(87|88|89)\d{7}$/) >> split(4, 3) |
728
730
  match(/^(90|91|92|93|94|95|96|97|98\d|99\d)\d{6}$/) >> split(6)
729
731
 
730
732
  # Lithuania
731
733
  #
732
734
  country '370',
733
735
  trunk('8', normalize: false) |
734
- one_of('700', '800') >> split(2,3) | # Service
735
- match(/^(6\d\d)\d+$/) >> split(2,3) | # Mobile
736
- one_of('5') >> split(3,2,2) | # Vilnius
737
- one_of('37','41') >> split(2,2,2) | # Kaunas, Šiauliai
738
- fixed(3) >> split(1,2,2) # 3-digit NDCs.
736
+ one_of('700', '800') >> split(2, 3) | # Service
737
+ match(/^(6\d\d)\d+$/) >> split(2, 3) | # Mobile
738
+ one_of('5') >> split(3, 2, 2) | # Vilnius
739
+ one_of('37', '41') >> split(2, 2, 2) | # Kaunas, Šiauliai
740
+ fixed(3) >> split(1, 2, 2) # 3-digit NDCs.
739
741
 
740
742
  # country '371' # Latvia, see special file
741
743
 
@@ -744,7 +746,7 @@ Phony.define do
744
746
  country '372',
745
747
  match(/^(5\d\d\d)\d+$/) >> split(3..4) | # Mobile
746
748
  match(/^((?:70|8[12])\d\d)\d+$/) >> split(4) | # Mobile
747
- fixed(3) >> split(4) # 3-digit NDCs
749
+ fixed(3) >> split(4) # 3-digit NDCs
748
750
 
749
751
  # country '373' # Moldova, see special file
750
752
 
@@ -759,15 +761,15 @@ Phony.define do
759
761
  # Monaco
760
762
  #
761
763
  country '377',
762
- one_of('6') >> split(2,2,2,2) | # mobile
763
- fixed(2) >> split(2,2,2)
764
+ one_of('6') >> split(2, 2, 2, 2) | # mobile
765
+ fixed(2) >> split(2, 2, 2)
764
766
 
765
767
  # San Marino
766
768
  country '378',
767
- trunk('', :normalize => false) |
769
+ trunk('', normalize: false) |
768
770
  none >> matched_split(
769
- /\A\d{6}\z/ => [3,3],
770
- /\A\d+\z/ => [3,3,4]
771
+ /\A\d{6}\z/ => [3, 3],
772
+ /\A\d+\z/ => [3, 3, 4]
771
773
  )
772
774
 
773
775
  country '379', todo # Vatican City State
@@ -783,7 +785,7 @@ Phony.define do
783
785
  # Note: https://en.wikipedia.org/wiki/Telephone_numbers_in_Kosovo
784
786
  country '383',
785
787
  trunk('0') |
786
- fixed(2) >> split(3,3)
788
+ fixed(2) >> split(3, 3)
787
789
 
788
790
  country '384', todo # -
789
791
 
@@ -794,19 +796,26 @@ Phony.define do
794
796
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Slovenia
795
797
  country '386',
796
798
  trunk('0') |
797
- one_of('30','31','40','41','51','64','65','66','67','68','69','70','71') >> split(3,3) | # Mobile
798
- one_of('1','2','3','4','5','7') >> split(3,4) | # Ljubljana, Maribor, Celje, Kranj, Nova Gorica, Novo mesto
799
- fixed(3) >> split(2,3) # catchall
799
+ one_of('30', '31', '40', '41', '51', '64', '65', '66', '67', '68', '69', '70', '71') >> split(3, 3) | # Mobile
800
+ one_of('1', '2', '3', '4', '5', '7') >> split(3, 4) | # Ljubljana, Maribor, Celje, Kranj, Nova Gorica, Novo mesto
801
+ fixed(3) >> split(2, 3) # catchall
800
802
 
801
- country '387', trunk('0') | fixed(2) >> split(3,3) # Bosnia and Herzegovina
802
- country '388', trunk('0') | fixed(2) >> split(3,2,2) # Group of countries, shared code
803
+ # Bosnia and Herzegovina
804
+ country '387',
805
+ trunk('0') |
806
+ match(/^(60)(?:31|32|33|34|38|39)/) >> split(7) | # BH Mobile
807
+ match(/^(64)(?:40|41|42|43|44|45)/) >> split(7) | # Haloo
808
+ match(/^(67)(?:11|12)/) >> split(7) | # Novotel
809
+ fixed(2) >> split(3, 3) # catchall
810
+
811
+ country '388', trunk('0') | fixed(2) >> split(3, 2, 2) # Group of countries, shared code
803
812
 
804
813
  # The Former Yugoslav Republic of Macedonia
805
814
  country '389',
806
- trunk('0') |
807
- one_of('2','3','4','5','6','7','8') >> split(3,4)
815
+ trunk('0') |
816
+ one_of('2', '3', '4', '5', '6', '7', '8') >> split(3, 4)
808
817
 
809
- country '420', fixed(3) >> split(3,3) # Czech Republic
818
+ country '420', fixed(3) >> split(3, 3) # Czech Republic
810
819
 
811
820
  # Slovak Republic.
812
821
  #
@@ -817,7 +826,7 @@ Phony.define do
817
826
  fixed(2) >> split(7) # 2-digit NDCs
818
827
 
819
828
  country '422', todo # Spare code
820
- country '423', none >> split(3,2,2) # Liechtenstein (Principality of)
829
+ country '423', none >> split(3, 2, 2) # Liechtenstein (Principality of)
821
830
  country '424', todo # -
822
831
  country '425', todo # -
823
832
  country '426', todo # -
@@ -825,74 +834,74 @@ Phony.define do
825
834
  country '428', todo # -
826
835
  country '429', todo # -
827
836
 
828
- country '500', none >> split(2,3) # Falkland Islands (Malvinas) http://www.wtng.info/wtng-500-fk.html
837
+ country '500', none >> split(2, 3) # Falkland Islands (Malvinas) http://www.wtng.info/wtng-500-fk.html
829
838
  country '501', fixed(3) >> split(4) # Belize
830
839
 
831
840
  # Guatemala (Republic of) http://www.wtng.info/wtng-502-gt.html
832
841
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
833
842
  #
834
843
  country '502',
835
- one_of('19') >> split(3,3,3) | # premium rate
836
- fixed(1) >> split(3,4)
844
+ one_of('19') >> split(3, 3, 3) | # premium rate
845
+ fixed(1) >> split(3, 4)
837
846
 
838
- # El Salvador (Republic of)
847
+ # El Salvador (Republic of)
839
848
  country '503', fixed(4) >> split(4)
840
849
 
841
850
  # Honduras (Republic of) http://www.wtng.info/wtng-504-hn.html
842
851
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
843
852
  country '504',
844
- one_of('800') >> split(3,4) | # freephone
845
- fixed(2) >> split(3,3) # geographic, mobile
853
+ one_of('800') >> split(3, 4) | # freephone
854
+ fixed(2) >> split(3, 3) # geographic, mobile
846
855
 
847
856
  # Nicaragua http://www.wtng.info/wtng-505-ni.html
848
857
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
849
858
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=NI
850
859
  country '505',
851
- one_of('9') >> split(3,3) | # premium rate
852
- fixed(2) >> split(3,3) # geographic, mobile
860
+ one_of('9') >> split(3, 3) | # premium rate
861
+ fixed(2) >> split(3, 3) # geographic, mobile
853
862
 
854
863
  # Costa Rica http://www.wtng.info/wtng-506-cr.html
855
864
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
856
865
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=CR
857
866
  country '506',
858
- one_of('800') >> split(3,4) | # freephone
859
- one_of(%w(905 909)) >> split(3,4) | # premium rate
860
- fixed(1) >> split(3,4) # geographic
867
+ one_of('800') >> split(3, 4) | # freephone
868
+ one_of(%w[905 909]) >> split(3, 4) | # premium rate
869
+ fixed(1) >> split(3, 4) # geographic
861
870
 
862
871
  # Panama (Republic of) http://www.wtng.info/wtng-507-pa.html
863
872
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
864
873
  country '507',
865
- one_of(%w(800 809)) >> split(4) | # freephone
866
- one_of('6') >> split(3,4) | # mobile
867
- fixed(1) >> split(3,3) # geographic, VoIP telephony, mobile, premium rate, shared cost, pager
874
+ one_of(%w[800 809]) >> split(4) | # freephone
875
+ one_of('6') >> split(3, 4) | # mobile
876
+ fixed(1) >> split(3, 3) # geographic, VoIP telephony, mobile, premium rate, shared cost, pager
868
877
 
869
878
  country '508', none >> split(3, 3) # Saint Pierre and Miquelon (Collectivité territoriale de la République française) http://www.wtng.info/wtng-508-pm.html
870
879
 
871
880
  country '509', # Haiti (Republic of)
872
- fixed(2) >> split(2,4)
881
+ fixed(2) >> split(2, 4)
873
882
 
874
883
  # Guadeloupe (French Department of) http://www.wtng.info/wtng-590-fr.html
875
884
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
876
885
  country '590', trunk('0') |
877
- fixed(3) >> split(2,2,2)
886
+ fixed(3) >> split(2, 2, 2)
878
887
 
879
888
  country '591', # Bolivia (Republic of) http://www.itu.int/oth/T020200001A/en
880
- fixed(1) >> split(3,4)
889
+ fixed(1) >> split(3, 4)
881
890
 
882
891
  # Guyana http://www.wtng.info/wtng-592-gy.html
883
892
  # https://www.numberingplans.com
884
893
  country '592',
885
894
  one_of('10') >> split(2) | # audiotext
886
- one_of(%w(11 16 17 18 19)) >> split(3) | # audiotext
895
+ one_of(%w[11 16 17 18 19]) >> split(3) | # audiotext
887
896
  fixed(3) >> split(4) # geographic, audiotext
888
897
 
889
898
  # Ecuador http://www.wtng.info/wtng-593-ec.html
890
899
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=EC&current_page=1
891
900
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Ecuador
892
901
  country '593',
893
- one_of('9') >> split(4,4) |
894
- match(/\A([\d]{2})\d{7}\z/) >> split(3,4) |
895
- fixed(1) >> split(3,4)
902
+ one_of('9') >> split(4, 4) |
903
+ match(/\A([\d]{2})\d{7}\z/) >> split(3, 4) |
904
+ fixed(1) >> split(3, 4)
896
905
 
897
906
  country '594', fixed(3) >> split(3, 3) # French Guiana (French Department of) http://www.wtng.info/wtng-594-fr.html
898
907
 
@@ -900,25 +909,25 @@ Phony.define do
900
909
 
901
910
  # Martinique (French Department of) http://www.wtng.info/wtng-596-mq.html, https://www.numberingplans.com
902
911
  country '596', trunk('0') |
903
- fixed(3) >> split(2,2,2)
912
+ fixed(3) >> split(2, 2, 2)
904
913
 
905
914
  # Suriname (Republic of) http://www.wtng.info/wtng-597-sr.html, https://www.numberingplans.com
906
915
  country '597',
907
916
  none >> matched_split(
908
- /\A[6789]\d+\z/ => [3,4], # freephone, mobile
909
- /\A[2345]\d+\z/ => [3,3], # geographic, VoIP telephony
917
+ /\A[6789]\d+\z/ => [3, 4], # freephone, mobile
918
+ /\A[2345]\d+\z/ => [3, 3] # geographic, VoIP telephony
910
919
  )
911
920
 
912
921
  # country '598' # Uruguay (Eastern Republic of), see special file
913
922
 
914
- country '599', one_of('9') >> split(3,4) | # Netherlands Antilles (Curacao)
915
- fixed(3) >> split(4) # (other)
923
+ country '599', one_of('9') >> split(3, 4) | # Netherlands Antilles (Curacao)
924
+ fixed(3) >> split(4) # (other)
916
925
 
917
926
  # Democratic Republic of Timor-Leste http://www.wtng.info/wtng-670-tl.html
918
927
  country '670',
919
928
  none >> matched_split(
920
- /\A7\d+\z/ => [4,4], # mobile
921
- /\A\d+\z/ => [3,4]
929
+ /\A7\d+\z/ => [4, 4], # mobile
930
+ /\A\d+\z/ => [3, 4]
922
931
  )
923
932
 
924
933
  country '671', todo # Spare code
@@ -926,7 +935,7 @@ Phony.define do
926
935
  # Australian External Territories https://en.wikipedia.org/wiki/Telephone_numbers_in_Norfolk_Island
927
936
  # Norfolk Island
928
937
  country '672',
929
- fixed(1) >> split(2,3) |
938
+ fixed(1) >> split(2, 3) |
930
939
  match(/^(2\d+)$/) >> split(3) | # Fixed
931
940
  match(/^(5\d+)$/) >> split(3) # Mobile
932
941
 
@@ -936,56 +945,56 @@ Phony.define do
936
945
  # Papua New Guinea
937
946
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=PG
938
947
  country '675',
939
- one_of(%w(180 181 182 183)) >> split(4) | # freephone
948
+ one_of(%w[180 181 182 183]) >> split(4) | # freephone
940
949
  one_of('170') >> split(2) | # mobile
941
950
  one_of('189') >> split(1) | # mobile
942
- one_of('184') >> split(4,4) | # ISP, PSDN X.28
943
- one_of(%w(185 270 271)) >> split(4) | # pager
944
- one_of(%w(275 276)) >> split(4) | # satellite
945
- one_of(%w(278 279)) >> split(2) | # satellite
946
- one_of('115') >> split(4,4) | # voicemail (mobile)
947
- one_of(%w(28 29)) >> split(3,2) | # pager
948
- one_of(%w(16 18)) >> split(3,2) | # ISP
949
- one_of(%w(70 71 72 74 75 76 78 79)) >> split(3,3) | # mobile
950
- one_of(%w(731 732 733 734 735 736 738 739)) >> split(2,3) | # mobile
951
- one_of(%w(770)) >> split(2,3) | # wireless geographic; Port Moresby, National Capital District
952
- one_of(%w(771)) >> split(2,3) | # wireless geographic; Momase region
953
- one_of(%w(772)) >> split(2,3) | # wireless geographic; Highlands region
954
- one_of(%w(7730)) >> split(1,3) | # wireless geographic; Southern region
955
- one_of(%w(774)) >> split(2,3) | # wireless geographic; Islands region
956
- one_of(%w(775)) >> split(2,3) | # mobile
957
- one_of(%w(80 81 82 83)) >> split(3,3) | # freephone
958
- one_of(%w(90 91 92 93)) >> split(3,3) | # geographic, ISDN
959
- one_of(%w(3 4 5 6 7 8 9)) >> split(3,3) # geographic
960
- fixed(1) >> split(3,3) # geographic
951
+ one_of('184') >> split(4, 4) | # ISP, PSDN X.28
952
+ one_of(%w[185 270 271]) >> split(4) | # pager
953
+ one_of(%w[275 276]) >> split(4) | # satellite
954
+ one_of(%w[278 279]) >> split(2) | # satellite
955
+ one_of('115') >> split(4, 4) | # voicemail (mobile)
956
+ one_of(%w[28 29]) >> split(3, 2) | # pager
957
+ one_of(%w[16 18]) >> split(3, 2) | # ISP
958
+ one_of(%w[70 71 72 74 75 76 78 79]) >> split(3, 3) | # mobile
959
+ one_of(%w[731 732 733 734 735 736 738 739]) >> split(2, 3) | # mobile
960
+ one_of(%w[770]) >> split(2, 3) | # wireless geographic; Port Moresby, National Capital District
961
+ one_of(%w[771]) >> split(2, 3) | # wireless geographic; Momase region
962
+ one_of(%w[772]) >> split(2, 3) | # wireless geographic; Highlands region
963
+ one_of(%w[7730]) >> split(1, 3) | # wireless geographic; Southern region
964
+ one_of(%w[774]) >> split(2, 3) | # wireless geographic; Islands region
965
+ one_of(%w[775]) >> split(2, 3) | # mobile
966
+ one_of(%w[80 81 82 83]) >> split(3, 3) | # freephone
967
+ one_of(%w[90 91 92 93]) >> split(3, 3) | # geographic, ISDN
968
+ one_of(%w[3 4 5 6 7 8 9]) >> split(3, 3) # geographic
969
+ fixed(1) >> split(3, 3) # geographic
961
970
 
962
971
  # Tonga (Kingdom of)
963
972
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=TO
964
973
  country '676',
965
974
  none >> matched_split(
966
- /\A(77|78|87|88|89)\d+\z/ => [2,3,2],
967
- /\A\d+\z/ => [2,3]
975
+ /\A(77|78|87|88|89)\d+\z/ => [2, 3, 2],
976
+ /\A\d+\z/ => [2, 3]
968
977
  )
969
978
 
970
979
  # Solomon Islands http://www.wtng.info/wtng-677-sb.html, https://www.numberingplans.com
971
980
  country '677',
972
981
  none >> matched_split(
973
- /\A7\d+\z/ => [4,3], # mobile
974
- /\A\d+\z/ => [2,3] # freephone, geographic, mobile, VoIP telephony
982
+ /\A7\d+\z/ => [4, 3], # mobile
983
+ /\A\d+\z/ => [2, 3] # freephone, geographic, mobile, VoIP telephony
975
984
  )
976
985
 
977
986
  # Vanuatu (Republic of) http://www.wtng.info/wtng-678-vu.html, https://www.numberingplans.com
978
987
  country '678',
979
988
  none >> matched_split(
980
- /\A[579]\d+\z/ => [4,3], # mobile
981
- /\A\d+\z/ => [2,3] # geographic, VoIP telephony
989
+ /\A[579]\d+\z/ => [4, 3], # mobile
990
+ /\A\d+\z/ => [2, 3] # geographic, VoIP telephony
982
991
  )
983
992
 
984
993
  country '679', none >> split(3, 4) # Fiji (Republic of) http://www.wtng.info/wtng-679-fj.html
985
994
 
986
995
  country '680', none >> split(3, 4) # Palau (Republic of) http://www.wtng.info/wtng-680-pw.html
987
996
  country '681', todo # Wallis and Futuna (Territoire français d'outre-mer)
988
- country '682', none >> split(2,3) # Cook Islands http://www.wtng.info/wtng-682-ck.html
997
+ country '682', none >> split(2, 3) # Cook Islands http://www.wtng.info/wtng-682-ck.html
989
998
  country '683', none >> split(4) # Niue http://www.wtng.info/wtng-683-nu.html
990
999
  country '684', todo # -
991
1000
 
@@ -993,18 +1002,18 @@ Phony.define do
993
1002
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=WS
994
1003
  country '685',
995
1004
  none >> matched_split(
996
- /\A800\d+\z/ => [3,3], # freephone
997
- /\A830\d+\z/ => [3,3], # shared cost
998
- /\A60\d+\z/ => [3,3], # wireless geographic
999
- /\A(71|72|75|76|77)\d+\z/ => [3,4], # mobile
1000
- /\A84\d+\z/ => [3,4], # wireless geographic
1001
- /\A\d+\z/ => [2,3] # geographic
1005
+ /\A800\d+\z/ => [3, 3], # freephone
1006
+ /\A830\d+\z/ => [3, 3], # shared cost
1007
+ /\A60\d+\z/ => [3, 3], # wireless geographic
1008
+ /\A(71|72|75|76|77)\d+\z/ => [3, 4], # mobile
1009
+ /\A84\d+\z/ => [3, 4], # wireless geographic
1010
+ /\A\d+\z/ => [2, 3] # geographic
1002
1011
  )
1003
1012
 
1004
1013
  country '686', none >> split(8) # Kiribati (Republic of) https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=KI
1005
- country '687', none >> split(3,3) # New Caledonia (Territoire français d'outre-mer) http://www.wtng.info/wtng-687-nc.html
1014
+ country '687', none >> split(3, 3) # New Caledonia (Territoire français d'outre-mer) http://www.wtng.info/wtng-687-nc.html
1006
1015
  country '688', none >> split(5) # Tuvalu http://www.wtng.info/wtng-688-tv.html
1007
- country '689', none >> split(2,2,2,2) # French Polynesia (Territoire français d'outre-mer) http://www.wtng.info/wtng-689-pf.html
1016
+ country '689', none >> split(2, 2, 2, 2) # French Polynesia (Territoire français d'outre-mer) http://www.wtng.info/wtng-689-pf.html
1008
1017
 
1009
1018
  country '690', fixed(1) >> split(3) # Tokelau http://www.wtng.info/wtng-690-tk.html
1010
1019
  country '691', none >> split(3, 4) # Micronesia (Federated States of) http://www.wtng.info/wtng-691-fm.html
@@ -1045,14 +1054,15 @@ Phony.define do
1045
1054
  # Democratic People's Republic of Korea
1046
1055
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=KP
1047
1056
  country '850',
1048
- one_of(%w(191 192 193)) >> split(3,4) | # mobile
1057
+ one_of(%w[191 192 193]) >> split(3, 4) | # mobile
1049
1058
  one_of('2') >> matched_split(
1050
- /\A\d{5}\z/ => [3,2],
1051
- /\A\d{7}\z/ => [3,4],
1052
- #/\A(880|881|882|883|885)\d+\z/ => [4,4,4,4],
1053
- /\A\d+\z/ => [3,3,3]) |
1054
- one_of(%w(31 39 41 45 53 57 61 67 73 79)) >> split(3,3) |
1055
- fixed(2) >> split(3,3)
1059
+ /\A\d{5}\z/ => [3, 2],
1060
+ /\A\d{7}\z/ => [3, 4],
1061
+ # /\A(880|881|882|883|885)\d+\z/ => [4,4,4,4],
1062
+ /\A\d+\z/ => [3, 3, 3]
1063
+ ) |
1064
+ one_of(%w[31 39 41 45 53 57 61 67 73 79]) >> split(3, 3) |
1065
+ fixed(2) >> split(3, 3)
1056
1066
 
1057
1067
  country '851', todo # Spare code
1058
1068
 
@@ -1060,22 +1070,22 @@ Phony.define do
1060
1070
 
1061
1071
  country '852',
1062
1072
  match(/^(800)\d+$/) >> split(2, 4) |
1063
- none >> split(4,4)
1073
+ none >> split(4, 4)
1064
1074
 
1065
1075
  # Macao, China
1066
1076
  country '853', # Macao, China
1067
- match(/^(28)\d+$/) >> split(2,4) | # Landline.
1068
- match(/^(8)\d+$/) >> split(3,4) | # Landline.
1069
- match(/^(6)\d+$/) >> split(3,4) # Mobile.
1077
+ match(/^(28)\d+$/) >> split(2, 4) | # Landline.
1078
+ match(/^(8)\d+$/) >> split(3, 4) | # Landline.
1079
+ match(/^(6)\d+$/) >> split(3, 4) # Mobile.
1070
1080
 
1071
1081
  country '854', todo # Spare code
1072
1082
 
1073
1083
  # Lao People's Democratic Republic http://www.wtng.info/wtng-856-la.html, https://www.numberingplans.com
1074
1084
  country '856',
1075
1085
  trunk('0') |
1076
- one_of('30') >> split(3,4) | # geographic
1077
- one_of('20') >> split(4,4) | # mobile
1078
- fixed(2) >> split(3,3) # geographic
1086
+ one_of('30') >> split(3, 4) | # geographic
1087
+ one_of('20') >> split(4, 4) | # mobile
1088
+ fixed(2) >> split(3, 3) # geographic
1079
1089
 
1080
1090
  country '857', todo # Spare code
1081
1091
  country '858', todo # Spare code
@@ -1097,7 +1107,7 @@ Phony.define do
1097
1107
 
1098
1108
  # Global Mobile Satellite System (i.e. Iridium, Globalstar, etc)
1099
1109
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=QM
1100
- country '881', fixed(1) >> split(3,5)
1110
+ country '881', fixed(1) >> split(3, 5)
1101
1111
 
1102
1112
  country '882', todo # International Networks, shared code
1103
1113
  country '883', todo # -
@@ -1123,58 +1133,59 @@ Phony.define do
1123
1133
 
1124
1134
  # Maldives (Republic of) http://www.wtng.info/wtng-960-mv.html, https://www.numberingplans.com
1125
1135
  country '960',
1126
- one_of(%w(800 900)) >> split(3,4) | # freephone, premium rate
1136
+ one_of(%w[800 900]) >> split(3, 4) | # freephone, premium rate
1127
1137
  fixed(3) >> split(4) # geographic, mobile
1128
1138
 
1129
1139
  # Lebanon
1130
1140
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
1131
1141
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=LB
1132
1142
  country '961',
1133
- one_of(%w(70 71 76 78 79)) >> split(3,3) | # mobile
1134
- one_of(%w(90 91)) >> split(3,3) | # premium rate
1135
- one_of(%w(80 81)) >> split(3,3) | # shared cost
1136
- one_of(%w(1 4 5 6 7 8 9)) >> split(3,3) | # geographic
1137
- one_of('3') >> split(3,3) | # mobile
1138
- fixed(1) >> split(3,3)
1143
+ one_of(%w[70 71 76 78 79]) >> split(3, 3) | # mobile
1144
+ one_of(%w[90 91]) >> split(3, 3) | # premium rate
1145
+ one_of(%w[80 81]) >> split(3, 3) | # shared cost
1146
+ one_of(%w[1 4 5 6 7 8 9]) >> split(3, 3) | # geographic
1147
+ one_of('3') >> split(3, 3) | # mobile
1148
+ fixed(1) >> split(3, 3)
1139
1149
 
1140
1150
  # Jordan (Hashemite Kingdom of)
1141
1151
  country '962',
1142
- one_of(%w(6250 8790)) >> split(4) | # wireless geographic
1143
- one_of(%w(800 801 802 803 804 805 806 807 808 809)) >> split(3,2) | # freephone
1144
- one_of('810') >> split(3,2) | # ISP
1145
- one_of('900') >> split(3,2) | # premium rate
1146
- one_of('70') >> split(3,3) | # universal access
1147
- one_of(%w(85 87)) >> split(3,3) | # shared cost
1148
- one_of(%w(2 3 5 6)) >> split(3,4) | # geographic
1149
- one_of('7') >> split(4,4) | # mobile, pager
1150
- fixed(1) >> split(3,4)
1152
+ one_of(%w[6250 8790]) >> split(4) | # wireless geographic
1153
+ one_of(%w[800 801 802 803 804 805 806 807 808 809]) >> split(3, 2) | # freephone
1154
+ one_of('810') >> split(3, 2) | # ISP
1155
+ one_of('900') >> split(3, 2) | # premium rate
1156
+ one_of('70') >> split(3, 3) | # universal access
1157
+ one_of(%w[85 87]) >> split(3, 3) | # shared cost
1158
+ one_of(%w[2 3 5 6]) >> split(3, 4) | # geographic
1159
+ one_of('7') >> split(4, 4) | # mobile, pager
1160
+ fixed(1) >> split(3, 4)
1151
1161
 
1152
1162
  # Syrian Arab Republic
1153
1163
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=SY
1154
1164
  country '963',
1155
- one_of(%w(11 14 31 33)) >> split(3,4) |
1156
- one_of(%w(12 13 15 16 21 22 23 25 34 41 43 51 52 53)) >> split(3,3) |
1157
- one_of('4') >> split(3,4) |
1158
- one_of('9') >> split(4,4) | # mobile
1159
- fixed(2) >> split(3,3)
1165
+ one_of(%w[11 14 31 33]) >> split(3, 4) |
1166
+ one_of(%w[12 13 15 16 21 22 23 25 34 41 43 51 52 53]) >> split(3, 3) |
1167
+ one_of('4') >> split(3, 4) |
1168
+ one_of('9') >> split(4, 4) | # mobile
1169
+ fixed(2) >> split(3, 3)
1160
1170
 
1161
1171
  # Iraq (Republic of)
1162
1172
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
1163
1173
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=IQ
1164
1174
  country '964',
1165
- one_of(%w(21 23 24 25 30 32 33 36 37 40 42 43 50 53 60 62 66)) >> split(3,3) |
1166
- one_of(%w(71 72 73 74 75 76 77 78 79)) >> split(4,4) | # mobile
1167
- one_of('1') >> split(3,4) |
1168
- fixed(2) >> split(3,3)
1175
+ one_of(%w[21 23 24 25 30 32 33 36 37 40 42 43 50 53 60 62 66]) >> split(3, 3) |
1176
+ one_of(%w[71 72 73 74 75 76 77 78 79]) >> split(4, 4) | # mobile
1177
+ one_of('1') >> split(3, 4) |
1178
+ fixed(2) >> split(3, 3)
1169
1179
 
1170
1180
  # Kuwait (State of) http://www.wtng.info/wtng-965-kw.html
1171
1181
  country '965',
1172
1182
  none >> matched_split(
1173
- /\A65816\d+\z/ => [4,4,4], # voicemail (mobile), Wataniya Telecom
1174
- /\A1\d+\z/ => [3,4], # geographic
1175
- /\A2\d+\z/ => [4,4], # geographic
1176
- /\A[569]\d+\z/ => [4,4], # mobile
1177
- /\A8\d+\z/ => [3,3], # geographic
1183
+ /\A65816\d+\z/ => [4, 4, 4], # voicemail (mobile), Wataniya Telecom
1184
+ /\A1\d+\z/ => [3, 4], # geographic
1185
+ /\A2\d+\z/ => [4, 4], # geographic
1186
+ /\A41\d+\z/ => [4, 4], # mobile (Virgin Mobile)
1187
+ /\A[569]\d+\z/ => [4, 4], # mobile
1188
+ /\A8\d+\z/ => [3, 3] # geographic
1178
1189
  )
1179
1190
 
1180
1191
  # country '966' # Saudi Arabia (Kingdom of), see special file.
@@ -1182,70 +1193,73 @@ Phony.define do
1182
1193
  # Yemen (Republic of)
1183
1194
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
1184
1195
  country '967',
1185
- one_of(%w(70 71 73 77)) >> split(3,4) | # mobile
1196
+ one_of(%w[70 71 73 77]) >> split(3, 4) | # mobile
1186
1197
  one_of('58') >> split(4) | # pager
1187
1198
  one_of('1') >> matched_split(
1188
- /\A\d{6}\z/ => [3,3],
1189
- /\A\d+\z/ => [3,4]) |
1190
- one_of(%w(2 3 4 5 6 7)) >> split(3,3) |
1191
- fixed(1) >> split(3,3)
1199
+ /\A\d{6}\z/ => [3, 3],
1200
+ /\A\d+\z/ => [3, 4]
1201
+ ) |
1202
+ one_of(%w[2 3 4 5 6 7]) >> split(3, 3) |
1203
+ fixed(1) >> split(3, 3)
1192
1204
 
1193
1205
  # Oman (Sultanate of), https://www.numberingplans.com/?page=dialling&sub=areacodes
1194
- country '968', fixed(2) >> split(3,3)
1206
+ country '968', fixed(2) >> split(3, 3)
1195
1207
 
1196
1208
  reserved '969' # Reserved - reservation currently under investigation
1197
1209
 
1198
1210
  country '970', # 970 is used in those countries that block access to 972 (Israel)
1199
- one_of('1') >> split(3,3,3) | # special numbers
1200
- one_of('2', '3', '4', '8', '9') >> split(3,4) | # 1 digit ndc
1201
- match(/^(5[023456789]|7[23467])\d+$/) >> split(3,4) # 2 digit ndc
1211
+ one_of('1') >> split(3, 3, 3) | # special numbers
1212
+ one_of('2', '3', '4', '8', '9') >> split(3, 4) | # 1 digit ndc
1213
+ match(/^(5[023456789]|7[23467])\d+$/) >> split(3, 4) # 2 digit ndc
1202
1214
 
1203
1215
  # United Arab Emirates
1204
1216
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
1205
1217
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=AE
1206
1218
  country '971',
1207
- one_of(%w(200 300)) >> split(3,3) | # shared cost
1208
- one_of('600') >> split(3,3) | # national rate
1209
- one_of(%w(500 700 900)) >> split(3,3) | # premium rate
1219
+ one_of(%w[200 300]) >> split(3, 3) | # shared cost
1220
+ one_of('600') >> split(3, 3) | # national rate
1221
+ one_of(%w[500 700 900]) >> split(3, 3) | # premium rate
1210
1222
  one_of('800') >> matched_split(
1211
- /\A\d{2}\z/ => [2],
1212
- /\A\d{7}\z/ => [2,3,2],
1213
- /\A\d+\z/ => [2,3,4]) | # freephone
1214
- one_of(%w(50 52 54 55 56 58)) >> split(3,4) | # mobile
1215
- one_of(%w(2 3 4 6 7 9)) >> split(3,4) |
1216
- fixed(1) >> split(3,4)
1223
+ /\A\d{2}\z/ => [2],
1224
+ /\A\d{7}\z/ => [2, 3, 2],
1225
+ /\A\d+\z/ => [2, 3, 4]
1226
+ ) | # freephone
1227
+ one_of(%w[50 52 54 55 56 58]) >> split(3, 4) | # mobile
1228
+ one_of(%w[2 3 4 6 7 9]) >> split(3, 4) |
1229
+ fixed(1) >> split(3, 4)
1217
1230
 
1218
1231
  # Israel (State of) (also works for numbers in Palestinian territories)
1219
1232
  country '972',
1220
- trunk('0') |
1221
- one_of('1') >> split(3,3,3) | # special numbers
1222
- one_of('2', '3', '4', '8', '9') >> split(3,4) | # 1 digit ndc
1223
- match(/^(5[012345689]|7[234679])\d+$/) >> split(3,4) # 2 digit ndc
1233
+ trunk('0') |
1234
+ one_of('1') >> split(3, 3, 3) | # special numbers
1235
+ one_of('2', '3', '4', '8', '9') >> split(3, 4) | # 1 digit ndc
1236
+ match(/^(5[012345689]|7[234679])\d+$/) >> split(3, 4) # 2 digit ndc
1224
1237
 
1225
- country '973', none >> split(4,4..4) # Bahrain (Kingdom of) http://www.itu.int/oth/T0202000011/en
1238
+ country '973', none >> split(4, 4..4) # Bahrain (Kingdom of) http://www.itu.int/oth/T0202000011/en
1226
1239
 
1227
1240
  # Qatar (State of)
1228
1241
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=QA
1229
1242
  country '974',
1230
- one_of(%w(1245 1744)) >> split(3,3) | # voicemail
1231
- one_of(%w(800 900)) >> split(2,2) | # freephone, audiotext
1232
- one_of(%w(20 21 22 26)) >> split(3,2) | # pager
1233
- one_of(%w(92 97)) >> split(3) | # mobile
1234
- fixed(2) >> split(3,3)
1243
+ one_of(%w[1245 1744]) >> split(3, 3) | # voicemail
1244
+ one_of(%w[800 900]) >> split(2, 2) | # freephone, audiotext
1245
+ one_of(%w[20 21 22 26]) >> split(3, 2) | # pager
1246
+ one_of(%w[92 97]) >> split(3) | # mobile
1247
+ fixed(2) >> split(3, 3)
1235
1248
 
1236
1249
  country '975', fixed(1) >> split(3, 3) # Bhutan (Kingdom of) http://www.wtng.info/wtng-975-bt.html
1237
1250
 
1238
1251
  # Mongolia
1239
1252
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=MN
1240
1253
  country '976',
1241
- one_of(%w(121 122 123 221 222 223)) >> matched_split(
1242
- /\A\d{4}\z/ => [2,2],
1243
- /\A\d+\z/ => [2,3]) |
1244
- one_of(%w(11 12 13 14 15 21 22 23 24 25)) >> split(3,2) |
1245
- one_of(%w(70 75 76 77 78 79)) >> split(3,3) | # VoIP telephony
1246
- one_of(%w(88 89 90 91 94 95 96 99)) >> split(3,3) | # mobile
1247
- one_of(%w(50 55 56 58 92)) >> split(3,3) | # wireless geographic
1248
- fixed(2) >> split(3,3)
1254
+ one_of(%w[121 122 123 221 222 223]) >> matched_split(
1255
+ /\A\d{4}\z/ => [2, 2],
1256
+ /\A\d+\z/ => [2, 3]
1257
+ ) |
1258
+ one_of(%w[11 12 13 14 15 21 22 23 24 25]) >> split(3, 2) |
1259
+ one_of(%w[70 75 76 77 78 79]) >> split(3, 3) | # VoIP telephony
1260
+ one_of(%w[88 89 90 91 94 95 96 99]) >> split(3, 3) | # mobile
1261
+ one_of(%w[50 55 56 58 92]) >> split(3, 3) | # wireless geographic
1262
+ fixed(2) >> split(3, 3)
1249
1263
 
1250
1264
  # country '977' # Nepal, see special file
1251
1265