phony 1.4.0 → 1.4.1

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.
data/lib/phony.rb CHANGED
@@ -17,12 +17,10 @@ require File.expand_path '../phony/dsl', __FILE__
17
17
  #
18
18
  # The ones that need more space to define.
19
19
  #
20
- require File.expand_path '../phony/countries', __FILE__
21
20
  require File.expand_path '../phony/countries/austria', __FILE__
22
21
  require File.expand_path '../phony/countries/belgium', __FILE__
23
22
  require File.expand_path '../phony/countries/chile', __FILE__
24
23
  require File.expand_path '../phony/countries/china', __FILE__
25
- require File.expand_path '../phony/countries/egypt', __FILE__
26
24
  require File.expand_path '../phony/countries/germany', __FILE__
27
25
  require File.expand_path '../phony/countries/greece', __FILE__
28
26
  require File.expand_path '../phony/countries/hungary', __FILE__
@@ -36,7 +34,7 @@ require File.expand_path '../phony/countries/united_kingdom', __FILE__
36
34
  #
37
35
  # All other countries.
38
36
  #
39
- require File.expand_path '../countries', __FILE__
37
+ require File.expand_path '../phony/countries', __FILE__
40
38
 
41
39
  module Phony
42
40
 
@@ -1 +1,399 @@
1
- module Phony::Countries end
1
+ # All countries, ordered by country code.
2
+ #
3
+ # Definitions are in the format:
4
+ # NDC >> National | NDC >> National | # ...
5
+ #
6
+ # As soon as a NDC matches, it goes on to the National part. Then breaks off.
7
+ # If the NDC does not match, it go on to the next (|, or "or") NDC.
8
+ #
9
+ # Available matching/splitting methods:
10
+ # * none: Does not have a national destination code, e.g. Denmark, Iceland.
11
+ # * one_of: Matches one of the following numbers. Splits if it does.
12
+ # * match: Try to match the regex, and if it matches, splits it off.
13
+ # * fixed: Always splits off a fixed length ndc. (Always use last in a | chain)
14
+ #
15
+ # For the national number part, there are two:
16
+ # * split: Use this number group splitting.
17
+ # * matched_split: Give a hash of regex => format array, with a :fallback => format option.
18
+ # (See Norway how it looks.)
19
+ #
20
+ # Note: The ones that are commented are defined in their special files.
21
+ #
22
+ Phony.define do
23
+ country '0', fixed(1) >> split(10) # Reserved.
24
+ country '1', fixed(3) >> split(3,4) # USA, Canada, etc.
25
+ country '7', fixed(3) >> split(3,2,2) # Kazakhstan (Republic of) & Russian Federation
26
+
27
+ country '20', one_of('800') >> split(7) | # Egypt
28
+ one_of('2', '3') >> split(8) | # Cairo/Giza, Alexandria
29
+ fixed(2) >> split(8)
30
+ # :mobile? => /^10|11|12|14|16|17|18|19*$/, :service? => /^800.*$/
31
+ country '27', fixed(2) >> split(3,4) # South Africa
32
+
33
+ # country '30', Phony::Countries::Greece
34
+ # country '31', Phony::Countries::Netherlands
35
+ # country '32', Phony::Countries::Belgium
36
+ country '33', fixed(1) >> split(2,2,2,2) # :service? => /^8.*$/, :mobile? => /^[67].*$/ # France
37
+ country '34', fixed(2) >> split(3,4) # Spain
38
+ # country '36', Phony::Countries::Hungary
39
+ # country '39', Phony::Countries::Italy
40
+
41
+ # country '40', Phony::Countries::Romania
42
+ # :service => %w{800 840 842 844 848}, :mobile => %w{74 76 77 78 79}
43
+ swiss_service_regex = /^(800|840|842|844|848)\d+$/
44
+ country '41', match(swiss_service_regex) >> split(3,3) | # Switzerland
45
+ fixed(2) >> split(3,2,2)
46
+ # country '43', Phony::Countries::Austria
47
+ # country '44', Phony::Countries::UnitedKingdom
48
+ country '45', none >> split(2,2,2,2) # Denmark
49
+ # country '46', Phony::Countries::Sweden
50
+ country '47', # Norway
51
+ none >> matched_split(/^[1].*$/ => [3], /^[489].*$/ => [3,2,3], :fallback => [2,2,2,2])
52
+ # Poland (Republic of)
53
+ # Although the NDCs are 2 digits, the representation is 3 digits.
54
+ # Note: http://wapedia.mobi/en/Telephone_numbers_in_Poland, mobile not yet correct
55
+ #
56
+ country '48', fixed(3) >> split(3,3) # Poland
57
+ # country '49', Phony::Countries::Germany
58
+
59
+ country '51', one_of('103', '105') >> split(3,3) | # Peru
60
+ one_of('1', '9') >> split(4,4) | # Lima and mobile.
61
+ fixed(2) >> split(4,4)
62
+ country '52', match(/^(0\d{2})\d+$/) >> split(2,2,2,2) | # Mexico
63
+ match(/^(33|55|81)\d+$/) >> split(2,2,2,2) |
64
+ match(/^(\d{3})\d+$/) >> split(3,2,2)
65
+ country '53', match(/^(5\d{3})\d+$/) >> split(4) | # Cuba. Mobile.
66
+ match(/^(7|21|22|23|4[1-8]|3[1-3])/) >> split(7) | #
67
+ fixed(3) >> split(7)
68
+ country '54', fixed(2) >> split(3,2,2) # TODO Argentine Republic
69
+ brazilian_service = /^(100|128|190|191|192|193|194|197|198|199)\d+$/
70
+ country '55', match(brazilian_service) >> split(3,3) | # Brazil (Federative Republic of)
71
+ fixed(2) >> split(4,4)
72
+ # :service? => brazilian_service, :mobile? => ?
73
+ # http://en.wikipedia.org/wiki/Telephone_numbers_in_Brazil
74
+ # country '56', Phony::Countries::Chile
75
+ country '57', fixed(2) >> split(3,2,2) # TODO Colombia
76
+ country '58', fixed(3) >> split(7) # Venezuela (Bolivarian Republic of)
77
+
78
+ # country '60', Phony::Countries::Malaysia
79
+ country '61', match(/^(4\d\d)\d+$/) >> split(3,3) | # Australia
80
+ fixed(1) >> split(4,4)
81
+ country '62', fixed(2) >> split(3,2,2) # TODO Indonesia (Republic of)
82
+ country '63', fixed(2) >> split(3,2,2) # TODO Philippines (Republic of the)
83
+ country '64', fixed(1) >> split(3,4) # New Zealand
84
+ country '65', fixed(2) >> split(3,2,2) # TODO Singapore (Republic of)
85
+ country '66', fixed(2) >> split(3,2,2) # TODO Thailand
86
+
87
+ country '81', fixed(2) >> split(3,2,2) # TODO Japan
88
+ # country '82', Phony::Countries::SouthKorea
89
+ country '84', fixed(2) >> split(3,2,2) # TODO Viet Nam (Socialist Republic of)
90
+ # country '86', Phony::Countries::China
91
+
92
+ country '90', fixed(3) >> split(3,4) # Turkey. Wiki says 7, but the examples say 3, 4.
93
+ country '91', fixed(2) >> split(3,2,2) # TODO India (Republic of)
94
+ country '92', fixed(2) >> split(3,2,2) # TODO Pakistan (Islamic Republic of), http://en.wikipedia.org/wiki/Telephone_numbers_in_Pakistan, NDC 2-5
95
+ country '93', fixed(2) >> split(7) # Afghanistan. Note: the document says 6, but the examples use 7. http://www.wtng.info/wtng-93-af.html
96
+
97
+ country '94', fixed(2) >> split(3,2,2) # TODO Sri Lanka (Democratic Socialist Republic of)
98
+ country '95', fixed(2) >> split(3,2,2) # TODO Myanmar (Union of)
99
+ country '98', fixed(2) >> split(3,2,2) # TODO Iran (Islamic Republic of)
100
+
101
+ country '210', fixed(2) >> split(3,2,2) # -
102
+ country '211', fixed(2) >> split(3,2,2) # -
103
+ country '212', fixed(2) >> split(3,2,2) # Morocco
104
+ country '213', fixed(2) >> split(3,4) # Algeria
105
+ country '214', fixed(2) >> split(3,2,2) # -
106
+ country '215', fixed(2) >> split(3,2,2) # -
107
+ country '216', fixed(1) >> split(3,4) # Tunisia
108
+ country '217', fixed(2) >> split(3,2,2) # -
109
+ country '218', fixed(2) >> split(3,2,2) # Lybia
110
+ country '219', fixed(2) >> split(3,2,2) # -
111
+
112
+ country '220', fixed(2) >> split(3,2,2) # Gambia
113
+ country '221', fixed(2) >> split(3,2,2) # Senegal
114
+ country '222', fixed(2) >> split(3,2,2) # Mauritania
115
+ country '223', fixed(2) >> split(3,2,2) # Mali
116
+ country '224', fixed(2) >> split(3,2,2) # Guinea
117
+ country '225', fixed(2) >> split(3,2,2) # Côte d'Ivoire
118
+ country '226', fixed(2) >> split(3,2,2) # Burkina Faso
119
+ country '227', fixed(2) >> split(3,2,2) # Niger
120
+ country '228', fixed(2) >> split(3,2,2) # Togolese Republic
121
+ country '229', fixed(2) >> split(3,2,2) # Benin
122
+
123
+ country '230', fixed(2) >> split(3,2,2) # Mauritius
124
+ country '231', fixed(2) >> split(3,2,2) # Liberia
125
+ country '232', fixed(2) >> split(3,2,2) # Sierra Leone
126
+ country '233', fixed(2) >> split(3,2,2) # Ghana
127
+ country '234', fixed(2) >> split(3,2,2) # Nigeria
128
+ country '235', fixed(2) >> split(3,2,2) # Chad
129
+ country '236', fixed(2) >> split(3,2,2) # Central African Republic
130
+ country '237', fixed(2) >> split(3,2,2) # Cameroon
131
+ country '238', fixed(2) >> split(3,2,2) # Cape Verde
132
+ country '239', fixed(2) >> split(3,2,2) # Sao Tome and Principe
133
+
134
+ country '240', fixed(2) >> split(3,2,2) # Equatorial Guinea
135
+ country '241', fixed(2) >> split(3,2,2) # Gabonese Republic
136
+ country '242', fixed(2) >> split(3,2,2) # Congo
137
+ country '243', fixed(2) >> split(3,2,2) # Democratic Republic of the Congo
138
+ country '244', fixed(2) >> split(3,2,2) # Angola
139
+ country '245', fixed(2) >> split(3,2,2) # Guinea-Bissau
140
+ country '246', fixed(2) >> split(3,2,2) # Diego Garcia
141
+ country '247', fixed(2) >> split(3,2,2) # Ascension
142
+ country '248', fixed(2) >> split(3,2,2) # Seychelles
143
+ country '249', fixed(2) >> split(3,2,2) # Sudan
144
+
145
+ country '250', fixed(2) >> split(3,2,2) # Rwanda
146
+ country '251', fixed(2) >> split(3,2,2) # Ethiopia
147
+ country '252', fixed(2) >> split(3,2,2) # Somali Democratic Republic
148
+ country '253', fixed(2) >> split(3,2,2) # Djibouti
149
+ country '254', fixed(2) >> split(3,2,2) # Kenya
150
+ country '255', fixed(2) >> split(3,2,2) # Tanzania
151
+ country '256', fixed(2) >> split(3,2,2) # Uganda
152
+ country '257', fixed(2) >> split(3,2,2) # Burundi
153
+ country '258', fixed(2) >> split(3,2,2) # Mozambique
154
+ country '259', fixed(2) >> split(3,2,2) # -
155
+
156
+ country '260', fixed(2) >> split(3,2,2) # Zambia
157
+ country '261', fixed(2) >> split(3,2,2) # Madagascar
158
+ country '262', fixed(3) >> split(3,2,2) # Reunion / Mayotte (new)
159
+ country '263', fixed(2) >> split(3,2,2) # Zimbabwe
160
+ country '264', fixed(2) >> split(3,2,2) # Namibia
161
+ country '265', fixed(2) >> split(3,2,2) # Malawi
162
+ country '266', fixed(2) >> split(3,2,2) # Lesotho
163
+ country '267', fixed(2) >> split(3,2,2) # Botswana
164
+ country '268', fixed(2) >> split(3,2,2) # Swaziland
165
+ country '269', fixed(2) >> split(3,2,2) # Comoros
166
+
167
+ country '280', fixed(2) >> split(3,2,2) # -
168
+ country '281', fixed(2) >> split(3,2,2) # -
169
+ country '282', fixed(2) >> split(3,2,2) # -
170
+ country '283', fixed(2) >> split(3,2,2) # -
171
+ country '284', fixed(2) >> split(3,2,2) # -
172
+ country '285', fixed(2) >> split(3,2,2) # -
173
+ country '286', fixed(2) >> split(3,2,2) # -
174
+ country '287', fixed(2) >> split(3,2,2) # -
175
+ country '288', fixed(2) >> split(3,2,2) # -
176
+ country '289', fixed(2) >> split(3,2,2) # -
177
+ country '290', fixed(2) >> split(3,2,2) # Saint Helena
178
+
179
+ country '291', fixed(2) >> split(3,2,2) # Eritrea
180
+ country '292', fixed(2) >> split(3,2,2) # -
181
+ country '293', fixed(2) >> split(3,2,2) # -
182
+ country '294', fixed(2) >> split(3,2,2) # -
183
+ country '295', fixed(2) >> split(3,2,2) # -
184
+ country '296', fixed(2) >> split(3,2,2) # -
185
+ country '297', fixed(2) >> split(3,2,2) # Aruba
186
+ country '298', fixed(2) >> split(3,2,2) # Faroe Islands
187
+ country '299', fixed(2) >> split(3,2,2) # Greenland
188
+
189
+ country '350', fixed(2) >> split(3,2,2) # Gibraltar
190
+ country '351', one_of('700', '800') >> split(3,3) | # Portugal
191
+ match(/^(9\d)\d+$/) >> split(3,4) | # mobile
192
+ one_of('21', '22') >> split(3,4) | # Lisboa & Porto
193
+ fixed(3) >> split(3,4)
194
+ country '352', fixed(2) >> split(3,2,2) # Luxembourg
195
+ country '353', fixed(2) >> split(3,2,2) # Ireland (0-3-4)
196
+ country '354', none >> split(3,4) # Iceland
197
+ country '355', fixed(2) >> split(3,2,2) # Albania
198
+ country '356', fixed(2) >> split(3,2,2) # Malta
199
+ country '357', fixed(2) >> split(3,2,2) # Cyprus
200
+ country '358', match(/^([6-8]00)\d+$/) >> split(3,3) | # Finland
201
+ match(/^(4\d|50)\d+$/) >> split(3,2,2) |
202
+ one_of('2','3','5','6','8','9') >> split(3,3) |
203
+ fixed(2) >> split(3,3)
204
+ country '359', fixed(2) >> split(3,2,2) # Bulgaria
205
+
206
+ country '370', one_of('700', '800') >> split(2,3) | # Lithuania
207
+ match(/^(6\d\d)\d+$/) >> split(2,3) | # Mobile
208
+ one_of('5') >> split(3,2,2) | # Vilnius
209
+ one_of('37','41') >> split(2,2,2) | #
210
+ fixed(3) >> split(1,2,2)
211
+ country '371', fixed(2) >> split(3,2,2) # Latvia
212
+ country '372', fixed(2) >> split(3,2,2) # Estonia
213
+ country '373', fixed(2) >> split(3,2,2) # Moldova
214
+ country '374', fixed(2) >> split(3,2,2) # Armenia
215
+ country '375', fixed(2) >> split(3,2,2) # Belarus
216
+ country '376', fixed(2) >> split(3,2,2) # Andorra
217
+ country '377', fixed(2) >> split(3,2,2) # Monaco
218
+ country '378', fixed(2) >> split(3,2,2) # San Marino
219
+ country '379', fixed(2) >> split(3,2,2) # Vatican City State
220
+
221
+ country '380', fixed(2) >> split(3,2,2) # Ukraine
222
+ country '381', fixed(2) >> split(3,2,2) # Serbia and Montenegro
223
+ country '382', fixed(2) >> split(3,2,2) # -
224
+ country '383', fixed(2) >> split(3,2,2) # -
225
+ country '384', fixed(2) >> split(3,2,2) # -
226
+ country '385', one_of('1') >> split(3,5) | # Croatia
227
+ fixed(2) >> split(3,5)
228
+ country '386', fixed(2) >> split(3,2,2) # Slovenia
229
+ country '387', fixed(2) >> split(3,2,2) # Bosnia and Herzegovina
230
+ country '388', fixed(2) >> split(3,2,2) # Group of countries, shared code
231
+ country '389', fixed(2) >> split(3,2,2) # The Former Yugoslav Republic of Macedonia
232
+
233
+ country '420', fixed(3) >> split(3,3) # Czech Republic
234
+ country '421', match(/^(9\d\d).+$/) >> split(6) | # Slovak Republic
235
+ one_of('2') >> split(8) | # Bratislava
236
+ fixed(2) >> split(7)
237
+ country '422', fixed(2) >> split(3,2,2) # Spare code
238
+ country '423', none >> split(3,2,2) # Liechtenstein (Principality of)
239
+ country '424', fixed(2) >> split(3,2,2) # -
240
+ country '425', fixed(2) >> split(3,2,2) # -
241
+ country '426', fixed(2) >> split(3,2,2) # -
242
+ country '427', fixed(2) >> split(3,2,2) # -
243
+ country '428', fixed(2) >> split(3,2,2) # -
244
+ country '429', fixed(2) >> split(3,2,2) # -
245
+
246
+ country '500', fixed(2) >> split(3,2,2) # Falkland Islands (Malvinas)
247
+ country '501', fixed(2) >> split(3,2,2) # Belize
248
+ country '502', fixed(2) >> split(3,2,2) # Guatemala (Republic of)
249
+ country '503', fixed(2) >> split(3,2,2) # El Salvador (Republic of)
250
+ country '504', fixed(2) >> split(3,2,2) # Honduras (Republic of)
251
+ country '505', fixed(2) >> split(3,2,2) # Nicaragua
252
+ country '506', fixed(2) >> split(3,2,2) # Costa Rica
253
+ country '507', fixed(2) >> split(3,2,2) # Panama (Republic of)
254
+ country '508', fixed(2) >> split(3,2,2) # Saint Pierre and Miquelon (Collectivité territoriale de la République française)
255
+ country '509', fixed(2) >> split(3,2,2) # Haiti (Republic of)
256
+
257
+ country '590', fixed(3) >> split(3,2,2) # Guadeloupe (French Department of)
258
+ country '591', fixed(2) >> split(3,2,2) # Bolivia (Republic of)
259
+ country '592', fixed(2) >> split(3,2,2) # Guyana
260
+ country '593', fixed(2) >> split(3,2,2) # Ecuador
261
+ country '594', fixed(3) >> split(3,2,2) # French Guiana (French Department of)
262
+ country '595', fixed(2) >> split(3,2,2) # Paraguay (Republic of)
263
+ country '596', fixed(3) >> split(3,2,2) # Martinique (French Department of)
264
+ country '597', fixed(2) >> split(3,2,2) # Suriname (Republic of)
265
+ country '598', fixed(2) >> split(3,2,2) # Uruguay (Eastern Republic of)
266
+ country '599', fixed(2) >> split(3,2,2) # Netherlands Antilles
267
+
268
+ country '670', fixed(2) >> split(3,2,2) # Democratic Republic of Timor-Leste
269
+ country '671', fixed(2) >> split(3,2,2) # Spare code
270
+ country '672', fixed(2) >> split(3,2,2) # Australian External Territories
271
+ country '673', fixed(2) >> split(3,2,2) # Brunei Darussalam
272
+ country '674', fixed(2) >> split(3,2,2) # Nauru (Republic of)
273
+ country '675', fixed(2) >> split(3,2,2) # Papua New Guinea
274
+ country '676', fixed(2) >> split(3,2,2) # Tonga (Kingdom of)
275
+ country '677', fixed(2) >> split(3,2,2) # Solomon Islands
276
+ country '678', fixed(2) >> split(3,2,2) # Vanuatu (Republic of)
277
+ country '679', fixed(2) >> split(3,2,2) # Fiji (Republic of)
278
+
279
+ country '680', fixed(2) >> split(3,2,2) # Palau (Republic of)
280
+ country '681', fixed(2) >> split(3,2,2) # Wallis and Futuna (Territoire français d'outre-mer)
281
+ country '682', fixed(2) >> split(3,2,2) # Cook Islands
282
+ country '683', fixed(2) >> split(3,2,2) # Niue
283
+ country '684', fixed(2) >> split(3,2,2) # -
284
+ country '685', fixed(2) >> split(3,2,2) # Samoa (Independent State of)
285
+ country '686', fixed(2) >> split(3,2,2) # Kiribati (Republic of)
286
+ country '687', fixed(2) >> split(3,2,2) # New Caledonia (Territoire français d'outre-mer)
287
+ country '688', fixed(2) >> split(3,2,2) # Tuvalu
288
+ country '689', fixed(2) >> split(3,2,2) # French Polynesia (Territoire français d'outre-mer)
289
+
290
+ country '690', fixed(2) >> split(3,2,2) # Tokelau
291
+ country '691', fixed(2) >> split(3,2,2) # Micronesia (Federated States of)
292
+ country '692', fixed(2) >> split(3,2,2) # Marshall Islands (Republic of the)
293
+ country '693', fixed(2) >> split(3,2,2) # -
294
+ country '694', fixed(2) >> split(3,2,2) # -
295
+ country '695', fixed(2) >> split(3,2,2) # -
296
+ country '696', fixed(2) >> split(3,2,2) # -
297
+ country '697', fixed(2) >> split(3,2,2) # -
298
+ country '698', fixed(2) >> split(3,2,2) # -
299
+ country '699', fixed(2) >> split(3,2,2) # -
300
+
301
+ country '800', fixed(2) >> split(3,2,2) # International Freephone Service
302
+ country '801', fixed(2) >> split(3,2,2) # -
303
+ country '802', fixed(2) >> split(3,2,2) # -
304
+ country '803', fixed(2) >> split(3,2,2) # -
305
+ country '804', fixed(2) >> split(3,2,2) # -
306
+ country '805', fixed(2) >> split(3,2,2) # -
307
+ country '806', fixed(2) >> split(3,2,2) # -
308
+ country '807', fixed(2) >> split(3,2,2) # -
309
+ country '808', fixed(2) >> split(3,2,2) # International Shared Cost Service (ISCS)
310
+ country '809', fixed(2) >> split(3,2,2) # -
311
+
312
+ country '830', fixed(2) >> split(3,2,2) # -
313
+ country '831', fixed(2) >> split(3,2,2) # -
314
+ country '832', fixed(2) >> split(3,2,2) # -
315
+ country '833', fixed(2) >> split(3,2,2) # -
316
+ country '834', fixed(2) >> split(3,2,2) # -
317
+ country '835', fixed(2) >> split(3,2,2) # -
318
+ country '836', fixed(2) >> split(3,2,2) # -
319
+ country '837', fixed(2) >> split(3,2,2) # -
320
+ country '838', fixed(2) >> split(3,2,2) # -
321
+ country '839', fixed(2) >> split(3,2,2) # -
322
+
323
+ country '850', fixed(2) >> split(3,2,2) # Democratic People's Republic of Korea
324
+ country '851', fixed(2) >> split(3,2,2) # Spare code
325
+ country '852', fixed(2) >> split(3,2,2) # Hong Kong, China
326
+ country '853', fixed(2) >> split(3,2,2) # Macao, China
327
+ country '854', fixed(2) >> split(3,2,2) # Spare code
328
+ country '855', fixed(2) >> split(3,2,2) # Cambodia (Kingdom of)
329
+ country '856', fixed(2) >> split(3,2,2) # Lao People's Democratic Republic
330
+ country '857', fixed(2) >> split(3,2,2) # Spare code
331
+ country '858', fixed(2) >> split(3,2,2) # Spare code
332
+ country '859', fixed(2) >> split(3,2,2) # Spare code
333
+
334
+ country '870', fixed(2) >> split(3,2,2) # Inmarsat SNAC
335
+ country '871', fixed(2) >> split(3,2,2) # Inmarsat (Atlantic Ocean-East)
336
+ country '872', fixed(2) >> split(3,2,2) # Inmarsat (Pacific Ocean)
337
+ country '873', fixed(2) >> split(3,2,2) # Inmarsat (Indian Ocean)
338
+ country '874', fixed(2) >> split(3,2,2) # Inmarsat (Atlantic Ocean-West)
339
+ country '875', fixed(2) >> split(3,2,2) # Reserved - Maritime Mobile Service Applications
340
+ country '876', fixed(2) >> split(3,2,2) # Reserved - Maritime Mobile Service Applications
341
+ country '877', fixed(2) >> split(3,2,2) # Reserved - Maritime Mobile Service Applications
342
+ country '878', fixed(2) >> split(3,2,2) # Universal Personal Telecommunication Service (UPT)
343
+ country '879', fixed(2) >> split(3,2,2) # Reserved for national non-commercial purposes
344
+
345
+ country '880', fixed(2) >> split(3,2,2) # Bangladesh (People's Republic of)
346
+ country '881', fixed(2) >> split(3,2,2) # International Mobile, shared code
347
+ country '882', fixed(2) >> split(3,2,2) # International Networks, shared code
348
+ country '883', fixed(2) >> split(3,2,2) # -
349
+ country '884', fixed(2) >> split(3,2,2) # -
350
+ country '885', fixed(2) >> split(3,2,2) # -
351
+ country '886', fixed(2) >> split(3,2,2) # Reserved
352
+ country '887', fixed(2) >> split(3,2,2) # -
353
+ country '888', fixed(2) >> split(3,2,2) # Reserved for future global service
354
+ country '889', fixed(2) >> split(3,2,2) # -
355
+
356
+ country '890', fixed(2) >> split(3,2,2) # -
357
+ country '891', fixed(2) >> split(3,2,2) # -
358
+ country '892', fixed(2) >> split(3,2,2) # -
359
+ country '893', fixed(2) >> split(3,2,2) # -
360
+ country '894', fixed(2) >> split(3,2,2) # -
361
+ country '895', fixed(2) >> split(3,2,2) # -
362
+ country '896', fixed(2) >> split(3,2,2) # -
363
+ country '897', fixed(2) >> split(3,2,2) # -
364
+ country '898', fixed(2) >> split(3,2,2) # -
365
+ country '899', fixed(2) >> split(3,2,2) # -
366
+
367
+ country '960', fixed(2) >> split(3,2,2) # Maldives (Republic of)
368
+ country '961', fixed(2) >> split(3,2,2) # Lebanon
369
+ country '962', fixed(2) >> split(3,2,2) # Jordan (Hashemite Kingdom of)
370
+ country '963', fixed(2) >> split(3,2,2) # Syrian Arab Republic
371
+ country '964', fixed(2) >> split(3,2,2) # Iraq (Republic of)
372
+ country '965', fixed(2) >> split(3,2,2) # Kuwait (State of)
373
+ country '966', fixed(2) >> split(3,2,2) # Saudi Arabia (Kingdom of)
374
+ country '967', fixed(2) >> split(3,2,2) # Yemen (Republic of)
375
+ country '968', fixed(2) >> split(3,2,2) # Oman (Sultanate of)
376
+ country '969', fixed(2) >> split(3,2,2) # Reserved - reservation currently under investigation
377
+
378
+ country '970', fixed(2) >> split(3,2,2) # Reserved
379
+ country '971', fixed(2) >> split(3,2,2) # United Arab Emirates
380
+ country '972', fixed(2) >> split(3,2,2) # Israel (State of)
381
+ country '973', fixed(2) >> split(3,2,2) # Bahrain (Kingdom of)
382
+ country '974', fixed(2) >> split(3,2,2) # Qatar (State of)
383
+ country '975', fixed(2) >> split(3,2,2) # Bhutan (Kingdom of)
384
+ country '976', fixed(2) >> split(3,2,2) # Mongolia
385
+ country '977', fixed(2) >> split(3,2,2) # Nepal
386
+ country '978', fixed(2) >> split(3,2,2) # -
387
+ country '979', fixed(2) >> split(3,2,2) # International Premium Rate Service (IPRS)
388
+
389
+ country '990', fixed(2) >> split(3,2,2) # Spare code
390
+ country '991', fixed(2) >> split(3,2,2) # Trial of a proposed new international telecommunication public correspondence service, shared code
391
+ country '992', fixed(2) >> split(3,2,2) # Tajikistan (Republic of)
392
+ country '993', fixed(2) >> split(3,2,2) # Turkmenistan
393
+ country '994', fixed(2) >> split(3,2,2) # Azerbaijani Republic
394
+ country '995', fixed(2) >> split(3,2,2) # Georgia
395
+ country '996', fixed(2) >> split(3,2,2) # Kyrgyz Republic
396
+ country '997', fixed(2) >> split(3,2,2) # Spare code
397
+ country '998', fixed(2) >> split(3,2,2) # Uzbekistan (Republic of)
398
+ country '999', fixed(2) >> split(3,2,2) # Reserved for possible future use within the Telecommunications for Disaster Relief (TDR) concept
399
+ end
@@ -5,6 +5,6 @@
5
5
 
6
6
  Phony.define do
7
7
  country '36', one_of('104', '105', '107', '112') >> split(3,3) | # special
8
- # TODO mobile
9
- one_of('1', :max_length => 2) >> split(3,4)
8
+ # TODO mobile
9
+ one_of('1', :max_length => 2) >> split(3,4)
10
10
  end
@@ -153,9 +153,9 @@ service = [ # Not exhaustive.
153
153
 
154
154
  # TODO Normalize!
155
155
  #
156
- # Phony::Countries::Italy = one_of(*service) >> split(3,3) |
157
- # one_of(*mobile) >> split(3,4) |
158
- # one_of(*ndcs, :max_length => 3) >> split(3,4)
156
+ # country '39', one_of(*service) >> split(3,3) |
157
+ # one_of(*mobile) >> split(3,4) |
158
+ # one_of(*ndcs, :max_length => 3) >> split(3,4)
159
159
 
160
160
  handlers = []
161
161
  handlers << Phony::NationalCode.new(
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: phony
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.4.0
5
+ version: 1.4.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Florian Hanke
@@ -23,12 +23,10 @@ extensions: []
23
23
  extra_rdoc_files:
24
24
  - README.textile
25
25
  files:
26
- - lib/countries.rb
27
26
  - lib/phony/countries/austria.rb
28
27
  - lib/phony/countries/belgium.rb
29
28
  - lib/phony/countries/chile.rb
30
29
  - lib/phony/countries/china.rb
31
- - lib/phony/countries/egypt.rb
32
30
  - lib/phony/countries/germany.rb
33
31
  - lib/phony/countries/greece.rb
34
32
  - lib/phony/countries/hungary.rb
@@ -54,7 +52,7 @@ files:
54
52
  - lib/phony/vanity.rb
55
53
  - lib/phony.rb
56
54
  - README.textile
57
- - spec/lib/countries_spec.rb
55
+ - spec/lib/phony/countries_spec.rb
58
56
  - spec/lib/phony/country_codes_spec.rb
59
57
  - spec/lib/phony/country_spec.rb
60
58
  - spec/lib/phony/local_splitters/fixed_spec.rb
@@ -95,7 +93,7 @@ signing_key:
95
93
  specification_version: 3
96
94
  summary: Fast international phone number (E164 standard) normalizing, splitting and formatting.
97
95
  test_files:
98
- - spec/lib/countries_spec.rb
96
+ - spec/lib/phony/countries_spec.rb
99
97
  - spec/lib/phony/country_codes_spec.rb
100
98
  - spec/lib/phony/country_spec.rb
101
99
  - spec/lib/phony/local_splitters/fixed_spec.rb
data/lib/countries.rb DELETED
@@ -1,399 +0,0 @@
1
- # All countries, ordered by country code.
2
- #
3
- # Definitions are in the format:
4
- # NDC >> National | NDC >> National | # ...
5
- #
6
- # As soon as a NDC matches, it goes on to the National part. Then breaks off.
7
- # If the NDC does not match, it go on to the next (|, or "or") NDC.
8
- #
9
- # Available matching/splitting methods:
10
- # * none: Does not have a national destination code, e.g. Denmark, Iceland.
11
- # * one_of: Matches one of the following numbers. Splits if it does.
12
- # * match: Try to match the regex, and if it matches, splits it off.
13
- # * fixed: Always splits off a fixed length ndc. (Always use last in a | chain)
14
- #
15
- # For the national number part, there are two:
16
- # * split: Use this number group splitting.
17
- # * matched_split: Give a hash of regex => format array, with a :fallback => format option.
18
- # (See Norway how it looks.)
19
- #
20
- # Note: The ones that are commented are defined in their special files.
21
- #
22
- Phony.define do
23
- country '0', fixed(1) >> split(10) # Reserved.
24
- country '1', fixed(3) >> split(3,4) # USA, Canada, etc.
25
- country '7', fixed(3) >> split(3,2,2) # Kazakhstan (Republic of) & Russian Federation
26
-
27
- country '20', one_of('800') >> split(7) | # Egypt
28
- one_of('2', '3') >> split(8) | # Cairo/Giza, Alexandria
29
- fixed(2) >> split(8)
30
- # :mobile? => /^10|11|12|14|16|17|18|19*$/, :service? => /^800.*$/
31
- country '27', fixed(2) >> split(3,4) # South Africa
32
-
33
- # country '30', Phony::Countries::Greece
34
- # country '31', Phony::Countries::Netherlands
35
- # country '32', Phony::Countries::Belgium
36
- country '33', fixed(1) >> split(2,2,2,2) # :service? => /^8.*$/, :mobile? => /^[67].*$/ # France
37
- country '34', fixed(2) >> split(3,4) # Spain
38
- # country '36', Phony::Countries::Hungary
39
- # country '39', Phony::Countries::Italy
40
-
41
- # country '40', Phony::Countries::Romania
42
- # :service => %w{800 840 842 844 848}, :mobile => %w{74 76 77 78 79}
43
- swiss_service_regex = /^(800|840|842|844|848)\d+$/
44
- country '41', match(swiss_service_regex) >> split(3,3) | # Switzerland
45
- fixed(2) >> split(3,2,2)
46
- # country '43', Phony::Countries::Austria
47
- # country '44', Phony::Countries::UnitedKingdom
48
- country '45', none >> split(2,2,2,2) # Denmark
49
- # country '46', Phony::Countries::Sweden
50
- country '47', # Norway
51
- none >> matched_split(/^[1].*$/ => [3], /^[489].*$/ => [3,2,3], :fallback => [2,2,2,2])
52
- # Poland (Republic of)
53
- # Although the NDCs are 2 digits, the representation is 3 digits.
54
- # Note: http://wapedia.mobi/en/Telephone_numbers_in_Poland, mobile not yet correct
55
- #
56
- country '48', fixed(3) >> split(3,3) # Poland
57
- # country '49', Phony::Countries::Germany
58
-
59
- country '51', one_of('103', '105') >> split(3,3) | # Peru
60
- one_of('1', '9') >> split(4,4) | # Lima and mobile.
61
- fixed(2) >> split(4,4)
62
- country '52', match(/^(0\d{2})\d+$/) >> split(2,2,2,2) | # Mexico
63
- match(/^(33|55|81)\d+$/) >> split(2,2,2,2) |
64
- match(/^(\d{3})\d+$/) >> split(3,2,2)
65
- country '53', match(/^(5\d{3})\d+$/) >> split(4) | # Cuba. Mobile.
66
- match(/^(7|21|22|23|4[1-8]|3[1-3])/) >> split(7) | #
67
- fixed(3) >> split(7)
68
- country '54', fixed(2) >> split(3,2,2) # TODO Argentine Republic
69
- brazilian_service = /^(100|128|190|191|192|193|194|197|198|199)\d+$/
70
- country '55', match(brazilian_service) >> split(3,3) | # Brazil (Federative Republic of)
71
- fixed(2) >> split(4,4)
72
- # :service? => brazilian_service, :mobile? => ?
73
- # http://en.wikipedia.org/wiki/Telephone_numbers_in_Brazil
74
- # country '56', Phony::Countries::Chile
75
- country '57', fixed(2) >> split(3,2,2) # TODO Colombia
76
- country '58', fixed(3) >> split(7) # Venezuela (Bolivarian Republic of)
77
-
78
- # country '60', Phony::Countries::Malaysia
79
- country '61', match(/^(4\d\d)\d+$/) >> split(3,3) | # Australia
80
- fixed(1) >> split(4,4)
81
- country '62', fixed(2) >> split(3,2,2) # TODO Indonesia (Republic of)
82
- country '63', fixed(2) >> split(3,2,2) # TODO Philippines (Republic of the)
83
- country '64', fixed(1) >> split(3,4) # New Zealand
84
- country '65', fixed(2) >> split(3,2,2) # TODO Singapore (Republic of)
85
- country '66', fixed(2) >> split(3,2,2) # TODO Thailand
86
-
87
- country '81', fixed(2) >> split(3,2,2) # TODO Japan
88
- # country '82', Phony::Countries::SouthKorea
89
- country '84', fixed(2) >> split(3,2,2) # TODO Viet Nam (Socialist Republic of)
90
- # country '86', Phony::Countries::China
91
-
92
- country '90', fixed(3) >> split(3,4) # Turkey. Wiki says 7, but the examples say 3, 4.
93
- country '91', fixed(2) >> split(3,2,2) # TODO India (Republic of)
94
- country '92', fixed(2) >> split(3,2,2) # TODO Pakistan (Islamic Republic of), http://en.wikipedia.org/wiki/Telephone_numbers_in_Pakistan, NDC 2-5
95
- country '93', fixed(2) >> split(7) # Afghanistan. Note: the document says 6, but the examples use 7. http://www.wtng.info/wtng-93-af.html
96
-
97
- country '94', fixed(2) >> split(3,2,2) # TODO Sri Lanka (Democratic Socialist Republic of)
98
- country '95', fixed(2) >> split(3,2,2) # TODO Myanmar (Union of)
99
- country '98', fixed(2) >> split(3,2,2) # TODO Iran (Islamic Republic of)
100
-
101
- country '210', fixed(2) >> split(3,2,2) # -
102
- country '211', fixed(2) >> split(3,2,2) # -
103
- country '212', fixed(2) >> split(3,2,2) # Morocco
104
- country '213', fixed(2) >> split(3,4) # Algeria
105
- country '214', fixed(2) >> split(3,2,2) # -
106
- country '215', fixed(2) >> split(3,2,2) # -
107
- country '216', fixed(1) >> split(3,4) # Tunisia
108
- country '217', fixed(2) >> split(3,2,2) # -
109
- country '218', fixed(2) >> split(3,2,2) # Lybia
110
- country '219', fixed(2) >> split(3,2,2) # -
111
-
112
- country '220', fixed(2) >> split(3,2,2) # Gambia
113
- country '221', fixed(2) >> split(3,2,2) # Senegal
114
- country '222', fixed(2) >> split(3,2,2) # Mauritania
115
- country '223', fixed(2) >> split(3,2,2) # Mali
116
- country '224', fixed(2) >> split(3,2,2) # Guinea
117
- country '225', fixed(2) >> split(3,2,2) # Côte d'Ivoire
118
- country '226', fixed(2) >> split(3,2,2) # Burkina Faso
119
- country '227', fixed(2) >> split(3,2,2) # Niger
120
- country '228', fixed(2) >> split(3,2,2) # Togolese Republic
121
- country '229', fixed(2) >> split(3,2,2) # Benin
122
-
123
- country '230', fixed(2) >> split(3,2,2) # Mauritius
124
- country '231', fixed(2) >> split(3,2,2) # Liberia
125
- country '232', fixed(2) >> split(3,2,2) # Sierra Leone
126
- country '233', fixed(2) >> split(3,2,2) # Ghana
127
- country '234', fixed(2) >> split(3,2,2) # Nigeria
128
- country '235', fixed(2) >> split(3,2,2) # Chad
129
- country '236', fixed(2) >> split(3,2,2) # Central African Republic
130
- country '237', fixed(2) >> split(3,2,2) # Cameroon
131
- country '238', fixed(2) >> split(3,2,2) # Cape Verde
132
- country '239', fixed(2) >> split(3,2,2) # Sao Tome and Principe
133
-
134
- country '240', fixed(2) >> split(3,2,2) # Equatorial Guinea
135
- country '241', fixed(2) >> split(3,2,2) # Gabonese Republic
136
- country '242', fixed(2) >> split(3,2,2) # Congo
137
- country '243', fixed(2) >> split(3,2,2) # Democratic Republic of the Congo
138
- country '244', fixed(2) >> split(3,2,2) # Angola
139
- country '245', fixed(2) >> split(3,2,2) # Guinea-Bissau
140
- country '246', fixed(2) >> split(3,2,2) # Diego Garcia
141
- country '247', fixed(2) >> split(3,2,2) # Ascension
142
- country '248', fixed(2) >> split(3,2,2) # Seychelles
143
- country '249', fixed(2) >> split(3,2,2) # Sudan
144
-
145
- country '250', fixed(2) >> split(3,2,2) # Rwanda
146
- country '251', fixed(2) >> split(3,2,2) # Ethiopia
147
- country '252', fixed(2) >> split(3,2,2) # Somali Democratic Republic
148
- country '253', fixed(2) >> split(3,2,2) # Djibouti
149
- country '254', fixed(2) >> split(3,2,2) # Kenya
150
- country '255', fixed(2) >> split(3,2,2) # Tanzania
151
- country '256', fixed(2) >> split(3,2,2) # Uganda
152
- country '257', fixed(2) >> split(3,2,2) # Burundi
153
- country '258', fixed(2) >> split(3,2,2) # Mozambique
154
- country '259', fixed(2) >> split(3,2,2) # -
155
-
156
- country '260', fixed(2) >> split(3,2,2) # Zambia
157
- country '261', fixed(2) >> split(3,2,2) # Madagascar
158
- country '262', fixed(3) >> split(3,2,2) # Reunion / Mayotte (new)
159
- country '263', fixed(2) >> split(3,2,2) # Zimbabwe
160
- country '264', fixed(2) >> split(3,2,2) # Namibia
161
- country '265', fixed(2) >> split(3,2,2) # Malawi
162
- country '266', fixed(2) >> split(3,2,2) # Lesotho
163
- country '267', fixed(2) >> split(3,2,2) # Botswana
164
- country '268', fixed(2) >> split(3,2,2) # Swaziland
165
- country '269', fixed(2) >> split(3,2,2) # Comoros
166
-
167
- country '280', fixed(2) >> split(3,2,2) # -
168
- country '281', fixed(2) >> split(3,2,2) # -
169
- country '282', fixed(2) >> split(3,2,2) # -
170
- country '283', fixed(2) >> split(3,2,2) # -
171
- country '284', fixed(2) >> split(3,2,2) # -
172
- country '285', fixed(2) >> split(3,2,2) # -
173
- country '286', fixed(2) >> split(3,2,2) # -
174
- country '287', fixed(2) >> split(3,2,2) # -
175
- country '288', fixed(2) >> split(3,2,2) # -
176
- country '289', fixed(2) >> split(3,2,2) # -
177
- country '290', fixed(2) >> split(3,2,2) # Saint Helena
178
-
179
- country '291', fixed(2) >> split(3,2,2) # Eritrea
180
- country '292', fixed(2) >> split(3,2,2) # -
181
- country '293', fixed(2) >> split(3,2,2) # -
182
- country '294', fixed(2) >> split(3,2,2) # -
183
- country '295', fixed(2) >> split(3,2,2) # -
184
- country '296', fixed(2) >> split(3,2,2) # -
185
- country '297', fixed(2) >> split(3,2,2) # Aruba
186
- country '298', fixed(2) >> split(3,2,2) # Faroe Islands
187
- country '299', fixed(2) >> split(3,2,2) # Greenland
188
-
189
- country '350', fixed(2) >> split(3,2,2) # Gibraltar
190
- country '351', one_of('700', '800') >> split(3,3) | # Portugal
191
- match(/^(9\d)\d+$/) >> split(3,4) | # mobile
192
- one_of('21', '22') >> split(3,4) | # Lisboa & Porto
193
- fixed(3) >> split(3,4)
194
- country '352', fixed(2) >> split(3,2,2) # Luxembourg
195
- country '353', fixed(2) >> split(3,2,2) # Ireland (0-3-4)
196
- country '354', none >> split(3,4) # Iceland
197
- country '355', fixed(2) >> split(3,2,2) # Albania
198
- country '356', fixed(2) >> split(3,2,2) # Malta
199
- country '357', fixed(2) >> split(3,2,2) # Cyprus
200
- country '358', match(/^([6-8]00)\d+$/) >> split(3,3) | # Finland
201
- match(/^(4\d|50)\d+$/) >> split(3,2,2) |
202
- one_of('2','3','5','6','8','9') >> split(3,3) |
203
- fixed(2) >> split(3,3)
204
- country '359', fixed(2) >> split(3,2,2) # Bulgaria
205
-
206
- country '370', one_of('700', '800') >> split(2,3) | # Lithuania
207
- match(/^(6\d\d)\d+$/) >> split(2,3) | # Mobile
208
- one_of('5') >> split(3,2,2) | # Vilnius
209
- one_of('37','41') >> split(2,2,2) | #
210
- fixed(3) >> split(1,2,2)
211
- country '371', fixed(2) >> split(3,2,2) # Latvia
212
- country '372', fixed(2) >> split(3,2,2) # Estonia
213
- country '373', fixed(2) >> split(3,2,2) # Moldova
214
- country '374', fixed(2) >> split(3,2,2) # Armenia
215
- country '375', fixed(2) >> split(3,2,2) # Belarus
216
- country '376', fixed(2) >> split(3,2,2) # Andorra
217
- country '377', fixed(2) >> split(3,2,2) # Monaco
218
- country '378', fixed(2) >> split(3,2,2) # San Marino
219
- country '379', fixed(2) >> split(3,2,2) # Vatican City State
220
-
221
- country '380', fixed(2) >> split(3,2,2) # Ukraine
222
- country '381', fixed(2) >> split(3,2,2) # Serbia and Montenegro
223
- country '382', fixed(2) >> split(3,2,2) # -
224
- country '383', fixed(2) >> split(3,2,2) # -
225
- country '384', fixed(2) >> split(3,2,2) # -
226
- country '385', one_of('1') >> split(3,5) | # Croatia
227
- fixed(2) >> split(3,5)
228
- country '386', fixed(2) >> split(3,2,2) # Slovenia
229
- country '387', fixed(2) >> split(3,2,2) # Bosnia and Herzegovina
230
- country '388', fixed(2) >> split(3,2,2) # Group of countries, shared code
231
- country '389', fixed(2) >> split(3,2,2) # The Former Yugoslav Republic of Macedonia
232
-
233
- country '420', fixed(3) >> split(3,3) # Czech Republic
234
- country '421', match(/^(9\d\d).+$/) >> split(6) | # Slovak Republic
235
- one_of('2') >> split(8) | # Bratislava
236
- fixed(2) >> split(7)
237
- country '422', fixed(2) >> split(3,2,2) # Spare code
238
- country '423', none >> split(3,2,2) # Liechtenstein (Principality of)
239
- country '424', fixed(2) >> split(3,2,2) # -
240
- country '425', fixed(2) >> split(3,2,2) # -
241
- country '426', fixed(2) >> split(3,2,2) # -
242
- country '427', fixed(2) >> split(3,2,2) # -
243
- country '428', fixed(2) >> split(3,2,2) # -
244
- country '429', fixed(2) >> split(3,2,2) # -
245
-
246
- country '500', fixed(2) >> split(3,2,2) # Falkland Islands (Malvinas)
247
- country '501', fixed(2) >> split(3,2,2) # Belize
248
- country '502', fixed(2) >> split(3,2,2) # Guatemala (Republic of)
249
- country '503', fixed(2) >> split(3,2,2) # El Salvador (Republic of)
250
- country '504', fixed(2) >> split(3,2,2) # Honduras (Republic of)
251
- country '505', fixed(2) >> split(3,2,2) # Nicaragua
252
- country '506', fixed(2) >> split(3,2,2) # Costa Rica
253
- country '507', fixed(2) >> split(3,2,2) # Panama (Republic of)
254
- country '508', fixed(2) >> split(3,2,2) # Saint Pierre and Miquelon (Collectivité territoriale de la République française)
255
- country '509', fixed(2) >> split(3,2,2) # Haiti (Republic of)
256
-
257
- country '590', fixed(3) >> split(3,2,2) # Guadeloupe (French Department of)
258
- country '591', fixed(2) >> split(3,2,2) # Bolivia (Republic of)
259
- country '592', fixed(2) >> split(3,2,2) # Guyana
260
- country '593', fixed(2) >> split(3,2,2) # Ecuador
261
- country '594', fixed(3) >> split(3,2,2) # French Guiana (French Department of)
262
- country '595', fixed(2) >> split(3,2,2) # Paraguay (Republic of)
263
- country '596', fixed(3) >> split(3,2,2) # Martinique (French Department of)
264
- country '597', fixed(2) >> split(3,2,2) # Suriname (Republic of)
265
- country '598', fixed(2) >> split(3,2,2) # Uruguay (Eastern Republic of)
266
- country '599', fixed(2) >> split(3,2,2) # Netherlands Antilles
267
-
268
- country '670', fixed(2) >> split(3,2,2) # Democratic Republic of Timor-Leste
269
- country '671', fixed(2) >> split(3,2,2) # Spare code
270
- country '672', fixed(2) >> split(3,2,2) # Australian External Territories
271
- country '673', fixed(2) >> split(3,2,2) # Brunei Darussalam
272
- country '674', fixed(2) >> split(3,2,2) # Nauru (Republic of)
273
- country '675', fixed(2) >> split(3,2,2) # Papua New Guinea
274
- country '676', fixed(2) >> split(3,2,2) # Tonga (Kingdom of)
275
- country '677', fixed(2) >> split(3,2,2) # Solomon Islands
276
- country '678', fixed(2) >> split(3,2,2) # Vanuatu (Republic of)
277
- country '679', fixed(2) >> split(3,2,2) # Fiji (Republic of)
278
-
279
- country '680', fixed(2) >> split(3,2,2) # Palau (Republic of)
280
- country '681', fixed(2) >> split(3,2,2) # Wallis and Futuna (Territoire français d'outre-mer)
281
- country '682', fixed(2) >> split(3,2,2) # Cook Islands
282
- country '683', fixed(2) >> split(3,2,2) # Niue
283
- country '684', fixed(2) >> split(3,2,2) # -
284
- country '685', fixed(2) >> split(3,2,2) # Samoa (Independent State of)
285
- country '686', fixed(2) >> split(3,2,2) # Kiribati (Republic of)
286
- country '687', fixed(2) >> split(3,2,2) # New Caledonia (Territoire français d'outre-mer)
287
- country '688', fixed(2) >> split(3,2,2) # Tuvalu
288
- country '689', fixed(2) >> split(3,2,2) # French Polynesia (Territoire français d'outre-mer)
289
-
290
- country '690', fixed(2) >> split(3,2,2) # Tokelau
291
- country '691', fixed(2) >> split(3,2,2) # Micronesia (Federated States of)
292
- country '692', fixed(2) >> split(3,2,2) # Marshall Islands (Republic of the)
293
- country '693', fixed(2) >> split(3,2,2) # -
294
- country '694', fixed(2) >> split(3,2,2) # -
295
- country '695', fixed(2) >> split(3,2,2) # -
296
- country '696', fixed(2) >> split(3,2,2) # -
297
- country '697', fixed(2) >> split(3,2,2) # -
298
- country '698', fixed(2) >> split(3,2,2) # -
299
- country '699', fixed(2) >> split(3,2,2) # -
300
-
301
- country '800', fixed(2) >> split(3,2,2) # International Freephone Service
302
- country '801', fixed(2) >> split(3,2,2) # -
303
- country '802', fixed(2) >> split(3,2,2) # -
304
- country '803', fixed(2) >> split(3,2,2) # -
305
- country '804', fixed(2) >> split(3,2,2) # -
306
- country '805', fixed(2) >> split(3,2,2) # -
307
- country '806', fixed(2) >> split(3,2,2) # -
308
- country '807', fixed(2) >> split(3,2,2) # -
309
- country '808', fixed(2) >> split(3,2,2) # International Shared Cost Service (ISCS)
310
- country '809', fixed(2) >> split(3,2,2) # -
311
-
312
- country '830', fixed(2) >> split(3,2,2) # -
313
- country '831', fixed(2) >> split(3,2,2) # -
314
- country '832', fixed(2) >> split(3,2,2) # -
315
- country '833', fixed(2) >> split(3,2,2) # -
316
- country '834', fixed(2) >> split(3,2,2) # -
317
- country '835', fixed(2) >> split(3,2,2) # -
318
- country '836', fixed(2) >> split(3,2,2) # -
319
- country '837', fixed(2) >> split(3,2,2) # -
320
- country '838', fixed(2) >> split(3,2,2) # -
321
- country '839', fixed(2) >> split(3,2,2) # -
322
-
323
- country '850', fixed(2) >> split(3,2,2) # Democratic People's Republic of Korea
324
- country '851', fixed(2) >> split(3,2,2) # Spare code
325
- country '852', fixed(2) >> split(3,2,2) # Hong Kong, China
326
- country '853', fixed(2) >> split(3,2,2) # Macao, China
327
- country '854', fixed(2) >> split(3,2,2) # Spare code
328
- country '855', fixed(2) >> split(3,2,2) # Cambodia (Kingdom of)
329
- country '856', fixed(2) >> split(3,2,2) # Lao People's Democratic Republic
330
- country '857', fixed(2) >> split(3,2,2) # Spare code
331
- country '858', fixed(2) >> split(3,2,2) # Spare code
332
- country '859', fixed(2) >> split(3,2,2) # Spare code
333
-
334
- country '870', fixed(2) >> split(3,2,2) # Inmarsat SNAC
335
- country '871', fixed(2) >> split(3,2,2) # Inmarsat (Atlantic Ocean-East)
336
- country '872', fixed(2) >> split(3,2,2) # Inmarsat (Pacific Ocean)
337
- country '873', fixed(2) >> split(3,2,2) # Inmarsat (Indian Ocean)
338
- country '874', fixed(2) >> split(3,2,2) # Inmarsat (Atlantic Ocean-West)
339
- country '875', fixed(2) >> split(3,2,2) # Reserved - Maritime Mobile Service Applications
340
- country '876', fixed(2) >> split(3,2,2) # Reserved - Maritime Mobile Service Applications
341
- country '877', fixed(2) >> split(3,2,2) # Reserved - Maritime Mobile Service Applications
342
- country '878', fixed(2) >> split(3,2,2) # Universal Personal Telecommunication Service (UPT)
343
- country '879', fixed(2) >> split(3,2,2) # Reserved for national non-commercial purposes
344
-
345
- country '880', fixed(2) >> split(3,2,2) # Bangladesh (People's Republic of)
346
- country '881', fixed(2) >> split(3,2,2) # International Mobile, shared code
347
- country '882', fixed(2) >> split(3,2,2) # International Networks, shared code
348
- country '883', fixed(2) >> split(3,2,2) # -
349
- country '884', fixed(2) >> split(3,2,2) # -
350
- country '885', fixed(2) >> split(3,2,2) # -
351
- country '886', fixed(2) >> split(3,2,2) # Reserved
352
- country '887', fixed(2) >> split(3,2,2) # -
353
- country '888', fixed(2) >> split(3,2,2) # Reserved for future global service
354
- country '889', fixed(2) >> split(3,2,2) # -
355
-
356
- country '890', fixed(2) >> split(3,2,2) # -
357
- country '891', fixed(2) >> split(3,2,2) # -
358
- country '892', fixed(2) >> split(3,2,2) # -
359
- country '893', fixed(2) >> split(3,2,2) # -
360
- country '894', fixed(2) >> split(3,2,2) # -
361
- country '895', fixed(2) >> split(3,2,2) # -
362
- country '896', fixed(2) >> split(3,2,2) # -
363
- country '897', fixed(2) >> split(3,2,2) # -
364
- country '898', fixed(2) >> split(3,2,2) # -
365
- country '899', fixed(2) >> split(3,2,2) # -
366
-
367
- country '960', fixed(2) >> split(3,2,2) # Maldives (Republic of)
368
- country '961', fixed(2) >> split(3,2,2) # Lebanon
369
- country '962', fixed(2) >> split(3,2,2) # Jordan (Hashemite Kingdom of)
370
- country '963', fixed(2) >> split(3,2,2) # Syrian Arab Republic
371
- country '964', fixed(2) >> split(3,2,2) # Iraq (Republic of)
372
- country '965', fixed(2) >> split(3,2,2) # Kuwait (State of)
373
- country '966', fixed(2) >> split(3,2,2) # Saudi Arabia (Kingdom of)
374
- country '967', fixed(2) >> split(3,2,2) # Yemen (Republic of)
375
- country '968', fixed(2) >> split(3,2,2) # Oman (Sultanate of)
376
- country '969', fixed(2) >> split(3,2,2) # Reserved - reservation currently under investigation
377
-
378
- country '970', fixed(2) >> split(3,2,2) # Reserved
379
- country '971', fixed(2) >> split(3,2,2) # United Arab Emirates
380
- country '972', fixed(2) >> split(3,2,2) # Israel (State of)
381
- country '973', fixed(2) >> split(3,2,2) # Bahrain (Kingdom of)
382
- country '974', fixed(2) >> split(3,2,2) # Qatar (State of)
383
- country '975', fixed(2) >> split(3,2,2) # Bhutan (Kingdom of)
384
- country '976', fixed(2) >> split(3,2,2) # Mongolia
385
- country '977', fixed(2) >> split(3,2,2) # Nepal
386
- country '978', fixed(2) >> split(3,2,2) # -
387
- country '979', fixed(2) >> split(3,2,2) # International Premium Rate Service (IPRS)
388
-
389
- country '990', fixed(2) >> split(3,2,2) # Spare code
390
- country '991', fixed(2) >> split(3,2,2) # Trial of a proposed new international telecommunication public correspondence service, shared code
391
- country '992', fixed(2) >> split(3,2,2) # Tajikistan (Republic of)
392
- country '993', fixed(2) >> split(3,2,2) # Turkmenistan
393
- country '994', fixed(2) >> split(3,2,2) # Azerbaijani Republic
394
- country '995', fixed(2) >> split(3,2,2) # Georgia
395
- country '996', fixed(2) >> split(3,2,2) # Kyrgyz Republic
396
- country '997', fixed(2) >> split(3,2,2) # Spare code
397
- country '998', fixed(2) >> split(3,2,2) # Uzbekistan (Republic of)
398
- country '999', fixed(2) >> split(3,2,2) # Reserved for possible future use within the Telecommunications for Disaster Relief (TDR) concept
399
- end
@@ -1,17 +0,0 @@
1
- # TODO Move this into the country definitions.
2
-
3
- # Egyptian phone numbers.
4
- #
5
- # http://en.wikipedia.org/wiki/Telephone_numbers_in_Egypt
6
- #
7
- ndcs = [
8
- '2', # Cairo/Giza
9
- '3', # Alexandria
10
- ]
11
-
12
- # TODO Change how one_of works. max_length should be optional.
13
- #
14
- Phony.define do
15
- Phony::Countries::Egypt = one_of('800') >> split(7) |
16
- one_of(ndcs, :max_length => 2) >> split(8)
17
- end