phony 2.0.0.beta4 → 2.0.0.beta5
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.
- checksums.yaml +15 -0
- data/lib/phony/countries/united_kingdom.rb +598 -25
- data/spec/lib/phony/countries_spec.rb +51 -24
- metadata +5 -7
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NWVhNDYzYzZjYTZiYTMzNjU0N2YwNzE5M2FkMzA2NmU2M2Q4N2EyYQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OTNkM2Q5NjQxNTliZjE1MmQxNjhkMDQ5NjhlZmI4NTRjN2MzNmZjYQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YWU4ZmQ5ZjFlMGJkNDI1OWNjOTJhNmI0NTlkNGMzYzcwMjcxYzFjNzJmMjg4
|
10
|
+
YjUzYjQyMDg4ZjU2M2Y3OGEwZjExNDM0YTIyZDEwYzdiOTZhMGQ5NjQ0Mzk3
|
11
|
+
ZWRmMWQwNTgxMTU2MzUxNmQyNmEwYzhlOWQ5NDNmNjQ2ZTY4ZjE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YzAxOTUxMDg3YzViNTZjMDBlYjgyYzk4MzUwY2E3OTkyZjZkNmZiMzI4YTc3
|
14
|
+
MGZhYWQ5ODZhZmRmMzZhNzVhODdlNmRhZThhZmFjM2JlOGYxOTY1YjUzMmQ4
|
15
|
+
NWI1YTg1ZWNjYzY2YzNhOGY5NjA5NTgzMDA2NjUzZTJmOGNiM2I=
|
@@ -2,6 +2,8 @@
|
|
2
2
|
# thus we use a separate file to not let countries.rb explode.
|
3
3
|
#
|
4
4
|
# Note: The United Kingdom uses a variable NDC format from length 2 to 5.
|
5
|
+
# Most UK numbers have ten digits but a few have only nine digits.
|
6
|
+
# http://www.aa-asterisk.org.uk/index.php/Category:UK_Number_Plan
|
5
7
|
#
|
6
8
|
# The UK is special in formatting in that it uses:
|
7
9
|
# a 2-4-4 formatting rule with area codes that are 2 digits long,
|
@@ -11,6 +13,14 @@
|
|
11
13
|
# There can be a mix of number lengths within a single area code.
|
12
14
|
#
|
13
15
|
|
16
|
+
mobile_ndc = [
|
17
|
+
# Mobile [4+6].
|
18
|
+
#
|
19
|
+
('7100'..'7599').to_a,
|
20
|
+
'7624', # Isle of Man
|
21
|
+
('7700'..'7999').to_a,
|
22
|
+
].flatten
|
23
|
+
|
14
24
|
two_digit_ndc = [
|
15
25
|
# Geographic [2+8] - includes (02x) 0 and (02x) 1 as NDO.
|
16
26
|
#
|
@@ -25,7 +35,7 @@ two_digit_ndc = [
|
|
25
35
|
'55', # Corporate
|
26
36
|
'56', # LIECS/VoIP
|
27
37
|
'70', # Personal numbers
|
28
|
-
'76', # Pagers (not 7624)
|
38
|
+
'76', # Pagers (not 7624, Mobile, Isle of Man)
|
29
39
|
]
|
30
40
|
|
31
41
|
# three_digit_ndc_with_nine_digits
|
@@ -48,7 +58,7 @@ three_digit_ndc = [
|
|
48
58
|
'141', # Glasgow
|
49
59
|
'151', # Liverpool
|
50
60
|
'161', # Manchester
|
51
|
-
'191', #
|
61
|
+
'191', # Tyneside, Sunderland and Durham (ELNS area)
|
52
62
|
|
53
63
|
# Non-geographic [3+7].
|
54
64
|
#
|
@@ -140,10 +150,10 @@ five_digit_ndc = [
|
|
140
150
|
'19467', # Gosforth
|
141
151
|
]
|
142
152
|
|
143
|
-
|
153
|
+
variable_length_number = [
|
144
154
|
# Geographic [4+6]/[4+5] - includes (01xxx) 0 and (01xxx) 1 as NDO.
|
145
155
|
#
|
146
|
-
# These 40 area codes have a mix of 4-6 and 4-5 numbers
|
156
|
+
# These 40 area codes have a mix of 4-6 and 4-5 numbers.
|
147
157
|
# The three 'mixed' areas also have part of their number
|
148
158
|
# range sub-allocated as 5-5.
|
149
159
|
'1204', # Bolton
|
@@ -186,44 +196,607 @@ no_split = [
|
|
186
196
|
'1949', # Whatton
|
187
197
|
'1963', # Wincanton
|
188
198
|
'1995', # Garstang
|
199
|
+
]
|
189
200
|
|
190
|
-
|
191
|
-
#
|
192
|
-
# Mobile [4+6].
|
193
|
-
#
|
194
|
-
('7100'..'7599').to_a,
|
195
|
-
'7624',
|
196
|
-
('7700'..'7999').to_a,
|
197
|
-
|
201
|
+
four_digit_ndc = [
|
198
202
|
# Geographic [4+6] - includes (01xxx) 0 and (01xxx) 1 as NDO.
|
199
203
|
#
|
200
|
-
#
|
204
|
+
# These 542 area codes have only 4-6 numbers.
|
201
205
|
# The three 'mixed' areas also have part of their number
|
202
206
|
# range sub-allocated as 5-5 and one also has some 5-4.
|
203
|
-
'
|
207
|
+
'1200', # Clitheroe
|
208
|
+
'1202', # Bournemouth
|
209
|
+
#1204 Bolton (see [4+6]/[4+5] areas)
|
210
|
+
'1205', # Boston
|
211
|
+
'1206', # Colchester
|
212
|
+
'1207', # Consett
|
213
|
+
#1208 Bodmin (see [4+6]/[4+5] areas)
|
214
|
+
'1209', # Redruth, Cornwall
|
215
|
+
'1223', # Cambridge
|
216
|
+
'1224', # Aberdeen
|
217
|
+
'1225', # Bath
|
218
|
+
'1226', # Barnsley
|
219
|
+
'1227', # Canterbury
|
220
|
+
'1228', # Carlisle
|
221
|
+
'1229', # Barrow-in-Furness and Millom (ELNS area)
|
222
|
+
'1233', # Ashford, Kent
|
223
|
+
'1234', # Bedford
|
224
|
+
'1235', # Abingdon
|
225
|
+
'1236', # Coatbridge
|
226
|
+
'1237', # Bideford
|
227
|
+
'1239', # Cardigan
|
228
|
+
'1241', # Arbroath
|
229
|
+
'1242', # Cheltenham
|
230
|
+
'1243', # Chichester, West Sussex
|
204
231
|
'1244', # Chester
|
232
|
+
'1245', # Chelmsford
|
233
|
+
'1246', # Chesterfield
|
234
|
+
'1248', # Bangor, Gwynedd
|
235
|
+
'1249', # Chippenham
|
236
|
+
'1250', # Blairgowrie
|
237
|
+
'1252', # Aldershot
|
238
|
+
'1253', # Blackpool
|
239
|
+
#1254 Blackburn (see [4+6]/[4+5] areas)
|
240
|
+
'1255', # Clacton-on-Sea
|
241
|
+
'1256', # Basingstoke
|
242
|
+
'1257', # Coppull, Chorley
|
243
|
+
'1258', # Blandford
|
244
|
+
'1259', # Alloa
|
245
|
+
'1260', # Congleton
|
246
|
+
'1261', # Banff
|
247
|
+
'1262', # Bridlington
|
248
|
+
'1263', # Cromer
|
249
|
+
'1264', # Andover
|
250
|
+
'1267', # Carmarthen
|
251
|
+
'1268', # Basildon
|
252
|
+
'1269', # Ammanford
|
253
|
+
'1270', # Crewe
|
254
|
+
'1271', # Barnstaple
|
255
|
+
'1273', # Brighton
|
256
|
+
'1274', # Bradford
|
257
|
+
'1275', # Clevedon, Bristol
|
258
|
+
#1276 Camberley (see [4+6]/[4+5] areas)
|
259
|
+
'1277', # Brentwood
|
260
|
+
'1278', # Bridgwater
|
261
|
+
'1279', # Bishop's Stortford
|
262
|
+
'1280', # Buckingham
|
263
|
+
'1282', # Burnley
|
264
|
+
'1283', # Burton-on-Trent
|
265
|
+
'1284', # Bury St Edmunds
|
266
|
+
'1285', # Cirencester
|
267
|
+
'1286', # Caernarfon
|
268
|
+
'1287', # Guisborough
|
269
|
+
'1288', # Bude
|
270
|
+
'1289', # Berwick-upon-Tweed
|
271
|
+
'1290', # Cumnock, Ayrshire
|
272
|
+
'1291', # Chepstow
|
273
|
+
'1292', # Ayr
|
274
|
+
'1293', # Crawley
|
275
|
+
'1294', # Ardrossan, Ayrshire
|
276
|
+
'1295', # Banbury
|
277
|
+
'1296', # Aylesbury
|
278
|
+
#1297 Axminster (see [4+6]/[4+5] areas)
|
279
|
+
#1298 Buxton (see [4+6]/[4+5] areas)
|
280
|
+
'1299', # Bewdley
|
281
|
+
'1300', # Cerne Abbas, Dorset
|
282
|
+
'1301', # Arrochar
|
283
|
+
'1302', # Doncaster
|
284
|
+
'1303', # Folkestone
|
285
|
+
'1304', # Dover
|
286
|
+
'1305', # Dorchester
|
287
|
+
'1306', # Dorking
|
288
|
+
'1307', # Forfar
|
289
|
+
'1308', # Bridport, Dorset
|
290
|
+
'1309', # Forres
|
291
|
+
'1320', # Fort Augustus
|
292
|
+
'1322', # Dartford
|
293
|
+
'1323', # Eastbourne
|
294
|
+
'1324', # Falkirk
|
295
|
+
'1325', # Darlington
|
296
|
+
'1326', # Falmouth
|
297
|
+
'1327', # Daventry
|
298
|
+
'1328', # Fakenham
|
299
|
+
'1329', # Fareham
|
300
|
+
'1330', # Banchory, Deeside
|
301
|
+
'1332', # Derby
|
302
|
+
'1333', # Peat Inn and Leven, Fife
|
303
|
+
'1334', # St Andrews, Fife
|
304
|
+
'1335', # Ashbourne
|
305
|
+
'1337', # Ladybank, Fife
|
306
|
+
'1339', # Aboyne and Ballater (ELNS area)
|
307
|
+
'1340', # Craigellachie, Elgin
|
308
|
+
'1341', # Barmouth, Dolgellau
|
309
|
+
'1342', # East Grinstead
|
310
|
+
'1343', # Elgin
|
311
|
+
'1344', # Bracknell, Easthampstead
|
312
|
+
'1346', # Fraserburgh
|
313
|
+
'1347', # Easingwold
|
314
|
+
'1348', # Fishguard
|
315
|
+
'1349', # Dingwall
|
316
|
+
'1350', # Dunkeld
|
317
|
+
'1352', # Mold, Flint
|
318
|
+
'1353', # Ely
|
319
|
+
'1354', # Chatteris and March, Cambridgeshire, Fenland
|
320
|
+
'1355', # East Kilbride
|
321
|
+
'1356', # Brechin, Edzell
|
322
|
+
'1357', # Strathaven, East Kilbride
|
323
|
+
'1358', # Ellon
|
324
|
+
'1359', # Pakenham, Elmswell
|
325
|
+
'1360', # Killearn, Drymen
|
326
|
+
'1361', # Duns
|
327
|
+
'1362', # Dereham
|
328
|
+
#1363 Crediton (see [4+6]/[4+5] areas)
|
329
|
+
#1364 Ashburton, Devon (see [4+6]/[4+5] areas)
|
330
|
+
'1366', # Downham Market
|
331
|
+
'1367', # Faringdon
|
332
|
+
'1368', # Dunbar
|
333
|
+
'1369', # Dunoon
|
334
|
+
'1371', # Great Dunmow, Essex
|
335
|
+
'1372', # Esher, Epsom
|
336
|
+
'1373', # Frome
|
337
|
+
'1375', # Grays Thurrock, Essex
|
338
|
+
'1376', # Braintree, Essex
|
339
|
+
'1377', # Driffield
|
340
|
+
'1379', # Diss
|
341
|
+
'1380', # Devizes
|
342
|
+
'1381', # Fortrose
|
205
343
|
'1382', # Dundee
|
344
|
+
'1383', # Dunfermline
|
345
|
+
#1384 Dudley (see [4+6]/[4+5] areas)
|
346
|
+
#1386 Evesham (see [4+6]/[4+5] areas)
|
206
347
|
'1387', # Dumfries (Mixed area)
|
348
|
+
'1388', # Bishop Auckland, Durham and Stanhope (Eastgate) (ELNS area)
|
349
|
+
'1389', # Dumbarton
|
350
|
+
'1392', # Exeter
|
351
|
+
'1394', # Felixstowe
|
352
|
+
'1395', # Budleigh Salterton, Exmouth
|
353
|
+
'1397', # Fort William
|
354
|
+
'1398', # Dulverton, Exmoor
|
355
|
+
'1400', # Honington
|
356
|
+
'1403', # Horsham
|
357
|
+
#1404 Honiton (see [4+6]/[4+5] areas)
|
358
|
+
'1405', # Goole
|
359
|
+
'1406', # Holbeach
|
360
|
+
'1407', # Holyhead
|
361
|
+
'1408', # Golspie
|
362
|
+
'1409', # Holsworthy
|
363
|
+
#1420 Alton (see [4+6]/[4+5] areas)
|
364
|
+
'1422', # Halifax
|
365
|
+
'1423', # Boroughbridge and Harrogate (ELNS area)
|
366
|
+
'1424', # Hastings
|
367
|
+
'1425', # Ringwood, Highcliffe; New Milton, Ashley
|
368
|
+
'1427', # Gainsborough
|
369
|
+
'1428', # Haslemere
|
207
370
|
'1429', # Hartlepool
|
208
|
-
'
|
371
|
+
'1430', # Market Weighton and North Cave, Howden (ELNS area)
|
372
|
+
'1431', # Helmsdale
|
373
|
+
'1432', # Hereford
|
374
|
+
'1433', # Hathersage
|
375
|
+
'1434', # Bellingham, Haltwhistle and Hexham (ELNS area)
|
376
|
+
'1435', # Heathfield
|
377
|
+
'1436', # Helensburgh
|
378
|
+
'1437', # Clynderwen and Haverfordwest (ELNS area)
|
379
|
+
'1438', # Stevenage, Hertfordshire
|
380
|
+
'1439', # Helmsley
|
381
|
+
'1440', # Haverhill
|
382
|
+
'1442', # Hemel Hempstead
|
383
|
+
'1443', # Pontypridd, Glamorgan
|
384
|
+
'1444', # Haywards Heath
|
385
|
+
'1445', # Gairloch
|
386
|
+
'1446', # Barry, Glamorgan
|
387
|
+
'1449', # Stowmarket, Gipping
|
388
|
+
'1450', # Hawick
|
389
|
+
'1451', # Stow-on-the-Wold, Gloucestershire
|
390
|
+
'1452', # Gloucester
|
391
|
+
'1453', # Dursley, Gloucestershire
|
392
|
+
'1454', # Chipping Sodbury, Gloucestershire
|
393
|
+
'1455', # Hinckley
|
394
|
+
'1456', # Glenurquhart
|
395
|
+
'1457', # Glossop
|
396
|
+
'1458', # Glastonbury
|
397
|
+
#1460 Chard, Ilminster (see [4+6]/[4+5] areas)
|
398
|
+
#1461 Gretna (see [4+6]/[4+5] areas)
|
399
|
+
'1462', # Hitchin
|
400
|
+
'1463', # Inverness
|
401
|
+
'1464', # Insch
|
402
|
+
'1465', # Girvan
|
403
|
+
'1466', # Huntly
|
404
|
+
'1467', # Inverurie
|
405
|
+
'1469', # Killingholme, Immingham
|
406
|
+
'1470', # Edinbane, Isle of Skye
|
407
|
+
'1471', # Broadford, Isle of Skye
|
408
|
+
'1472', # Grimsby
|
409
|
+
'1473', # Ipswich
|
410
|
+
'1474', # Gravesend
|
411
|
+
'1475', # Greenock
|
412
|
+
'1476', # Grantham
|
413
|
+
'1477', # Holmes Chapel
|
414
|
+
'1478', # Portree, Isle of Skye
|
415
|
+
'1479', # Grantown-on-Spey
|
416
|
+
#1480 Huntingdon (see [4+6]/[4+5] areas)
|
417
|
+
'1481', # Guernsey
|
418
|
+
'1482', # Kingston-upon-Hull
|
419
|
+
'1483', # Guildford
|
420
|
+
'1484', # Huddersfield
|
421
|
+
'1485', # Hunstanton
|
422
|
+
'1487', # Warboys, Huntingdon
|
423
|
+
#1488 Hungerford (see [4+6]/[4+5] areas)
|
424
|
+
'1489', # Bishops Waltham, Hamble Valley
|
425
|
+
'1490', # Corwen, Gwynedd
|
426
|
+
'1491', # Henley-on-Thames
|
427
|
+
'1492', # Colwyn Bay, Gwynedd
|
428
|
+
'1493', # Great Yarmouth
|
429
|
+
'1494', # High Wycombe
|
430
|
+
'1495', # Pontypool, Gwent
|
431
|
+
'1496', # Port Ellen, Islay
|
432
|
+
'1497', # Hay-on-Wye
|
433
|
+
'1499', # Inveraray
|
434
|
+
'1501', # Harthill, Lothian
|
435
|
+
'1502', # Lowestoft
|
436
|
+
'1503', # Looe
|
437
|
+
'1505', # Johnstone
|
438
|
+
'1506', # Bathgate, Lothian
|
439
|
+
'1507', # Alford (Lincs), Louth and Spilsby (Horncastle) (ELNS area)
|
440
|
+
'1508', # Brooke
|
441
|
+
'1509', # Loughborough
|
442
|
+
'1520', # Lochcarron
|
443
|
+
'1522', # Lincoln
|
444
|
+
#1524 Lancaster (Mixed area) (see [4+6]/[4+5] areas)
|
445
|
+
'1525', # Leighton Buzzard
|
446
|
+
'1526', # Martin, Lincolnshire
|
447
|
+
#1527 Redditch (see [4+6]/[4+5] areas)
|
448
|
+
'1528', # Laggan, Badenoch
|
449
|
+
'1529', # Sleaford, Lincolnshire
|
450
|
+
'1530', # Coalville, Ashby-de-la-Zouch, Leicestershire
|
451
|
+
'1531', # Ledbury
|
452
|
+
'1534', # Jersey
|
453
|
+
'1535', # Keighley
|
454
|
+
'1536', # Kettering
|
455
|
+
'1538', # Ipstones, Leek
|
209
456
|
'1539', # Kendal (Mixed area)
|
457
|
+
'1540', # Kingussie
|
458
|
+
'1542', # Keith
|
459
|
+
'1543', # Cannock, Lichfield
|
460
|
+
'1544', # Kington
|
461
|
+
'1545', # Llanarth, Ceredigion
|
462
|
+
'1546', # Lochgilphead
|
463
|
+
'1547', # Knighton
|
464
|
+
'1548', # Kingsbridge
|
465
|
+
'1549', # Lairg
|
466
|
+
'1550', # Llandovery
|
467
|
+
'1553', # King's Lynn
|
468
|
+
'1554', # Llanelli
|
469
|
+
'1555', # Lanark
|
470
|
+
'1556', # Castle Douglas, Kirkcudbrightshire
|
471
|
+
'1557', # Kirkcudbright
|
472
|
+
'1558', # Llandeilo
|
473
|
+
'1559', # Llandysul
|
474
|
+
'1560', # Moscow
|
475
|
+
'1561', # Laurencekirk
|
476
|
+
#1562 Kidderminster (see [4+6]/[4+5] areas)
|
477
|
+
'1563', # Kilmarnock
|
478
|
+
'1564', # Lapworth, Knowle
|
479
|
+
'1565', # Knutsford
|
480
|
+
#1566 Launceston (see [4+6]/[4+5] areas)
|
481
|
+
'1567', # Killin
|
482
|
+
'1568', # Leominster
|
483
|
+
'1569', # Stonehaven, Laurencekirk
|
484
|
+
'1570', # Lampeter
|
485
|
+
'1571', # Lochinver
|
486
|
+
'1572', # Oakham
|
487
|
+
'1573', # Kelso
|
488
|
+
'1575', # Kirriemuir
|
489
|
+
'1576', # Lockerbie
|
490
|
+
'1577', # Kinross
|
491
|
+
'1578', # Lauder
|
492
|
+
'1579', # Liskeard
|
493
|
+
'1580', # Cranbrook, Kent
|
494
|
+
'1581', # New Luce, Luce
|
210
495
|
'1582', # Luton
|
496
|
+
'1583', # Carradale, Kintyre
|
497
|
+
'1584', # Ludlow
|
498
|
+
'1586', # Campbeltown, Kintyre
|
499
|
+
'1588', # Bishops Castle, Ludlow
|
500
|
+
'1590', # Lymington
|
501
|
+
'1591', # Llanwrtyd Wells
|
502
|
+
'1592', # Kirkcaldy
|
503
|
+
'1593', # Lybster
|
504
|
+
'1594', # Lydney
|
505
|
+
'1595', # Lerwick, Foula and Fair Isle
|
506
|
+
'1597', # Llandrindod Wells
|
507
|
+
'1598', # Lynton
|
508
|
+
'1599', # Kyle
|
509
|
+
'1600', # Monmouth
|
510
|
+
'1603', # Norwich
|
511
|
+
'1604', # Northampton
|
512
|
+
#1606 Northwich (see [4+6]/[4+5] areas)
|
513
|
+
'1608', # Chipping Norton
|
514
|
+
'1609', # Northallerton
|
515
|
+
'1620', # North Berwick
|
516
|
+
'1621', # Maldon
|
517
|
+
'1622', # Maidstone
|
518
|
+
'1623', # Mansfield
|
519
|
+
'1624', # Isle of Man
|
520
|
+
'1625', # Macclesfield
|
521
|
+
'1626', # Newton Abbot
|
522
|
+
'1628', # Maidenhead
|
523
|
+
#1629 Matlock (see [4+6]/[4+5] areas)
|
524
|
+
'1630', # Market Drayton
|
525
|
+
'1631', # Oban
|
526
|
+
#1632 Numbers for Drama
|
527
|
+
'1633', # Newport
|
528
|
+
'1634', # Medway
|
529
|
+
#1635 Newbury (see [4+6]/[4+5] areas)
|
530
|
+
'1636', # Newark-on-Trent
|
531
|
+
'1637', # Newquay
|
532
|
+
'1638', # Newmarket
|
533
|
+
'1639', # Neath
|
534
|
+
'1641', # Strathy, Melvich
|
535
|
+
'1642', # Middlesbrough
|
536
|
+
'1643', # Minehead
|
537
|
+
'1644', # New Galloway
|
538
|
+
'1646', # Milford Haven
|
539
|
+
#1647 Moretonhampstead (see [4+6]/[4+5] areas)
|
540
|
+
'1650', # Cemmaes Road, Machynlleth
|
541
|
+
'1651', # Oldmeldrum
|
542
|
+
'1652', # Brigg, North Kelsey
|
543
|
+
'1653', # Malton
|
544
|
+
'1654', # Machynlleth
|
545
|
+
'1655', # Maybole
|
546
|
+
'1656', # Bridgend
|
547
|
+
#1659 Sanquhar, Nithsdale (see [4+6]/[4+5] areas)
|
548
|
+
'1661', # Prudhoe, Northumberland
|
549
|
+
'1663', # New Mills
|
550
|
+
'1664', # Melton Mowbray
|
551
|
+
'1665', # Alnwick, Northumberland
|
552
|
+
'1666', # Malmesbury
|
553
|
+
'1667', # Nairn
|
554
|
+
'1668', # Bamburgh, Northumberland
|
555
|
+
'1669', # Rothbury, Northumberland
|
211
556
|
'1670', # Morpeth
|
557
|
+
'1671', # Newton Stewart
|
558
|
+
'1672', # Marlborough
|
559
|
+
'1673', # Market Rasen
|
560
|
+
'1674', # Montrose
|
561
|
+
'1675', # Coleshill, Warwickshire, Meriden
|
562
|
+
'1676', # Meriden
|
563
|
+
'1677', # Bedale, North Riding
|
564
|
+
'1678', # Bala, Meirionydd
|
565
|
+
'1680', # Craignure, Isle of Mull
|
566
|
+
'1681', # Fionnphort, Isle of Mull
|
567
|
+
'1683', # Moffat
|
568
|
+
'1684', # Malvern
|
569
|
+
'1685', # Merthyr Tydfil
|
570
|
+
'1686', # Llanidloes and Newtown (ELNS area)
|
571
|
+
'1687', # Mallaig
|
572
|
+
'1688', # Tobermory, Isle of Mull
|
573
|
+
'1689', # Orpington
|
574
|
+
'1690', # Betws-y-Coed
|
575
|
+
'1691', # Oswestry
|
576
|
+
'1692', # North Walsham
|
577
|
+
'1694', # Church Stretton
|
578
|
+
#1695 Skelmersdale (see [4+6]/[4+5] areas)
|
212
579
|
'1697', # Brampton (Mixed area)
|
580
|
+
'1698', # Motherwell
|
581
|
+
'1700', # Rothesay
|
582
|
+
'1702', # Southend-on-Sea
|
583
|
+
'1704', # Southport
|
584
|
+
'1706', # Rochdale, Rossendale
|
585
|
+
'1707', # Welwyn Garden City, Hatfield and Potters Bar
|
586
|
+
'1708', # Romford
|
587
|
+
'1709', # Rotherham
|
588
|
+
'1720', # Isles of Scilly
|
589
|
+
'1721', # Peebles
|
590
|
+
'1722', # Salisbury
|
591
|
+
'1723', # Scarborough
|
592
|
+
'1724', # Scunthorpe
|
593
|
+
'1725', # Rockbourne
|
594
|
+
#1726 St Austell (see [4+6]/[4+5] areas)
|
595
|
+
'1727', # St Albans
|
596
|
+
'1728', # Saxmundham
|
597
|
+
'1729', # Settle, Ribblesdale
|
213
598
|
'1730', # Petersfield
|
599
|
+
'1732', # Sevenoaks
|
600
|
+
'1733', # Peterborough
|
214
601
|
'1736', # Penzance
|
602
|
+
'1737', # Redhill
|
603
|
+
'1738', # Perth
|
604
|
+
'1740', # Sedgefield
|
605
|
+
'1743', # Shrewsbury
|
606
|
+
#1744 St Helens (see [4+6]/[4+5] areas)
|
607
|
+
'1745', # Rhyl
|
608
|
+
'1746', # Bridgnorth, Shropshire
|
609
|
+
'1747', # Shaftesbury
|
610
|
+
'1748', # Richmond
|
611
|
+
'1749', # Shepton Mallet
|
612
|
+
#1750 Selkirk (see [4+6]/[4+5] areas)
|
613
|
+
'1751', # Pickering
|
614
|
+
'1752', # Plymouth
|
615
|
+
'1753', # Slough
|
616
|
+
'1754', # Skegness
|
617
|
+
'1756', # Skipton
|
618
|
+
'1757', # Selby
|
619
|
+
'1758', # Pwllheli
|
620
|
+
'1759', # Pocklington
|
621
|
+
'1760', # Swaffham
|
622
|
+
'1761', # Temple Cloud, Somerset
|
623
|
+
'1763', # Royston
|
624
|
+
'1764', # Crieff, Ruthven
|
625
|
+
'1765', # Ripon
|
626
|
+
'1766', # Porthmadog
|
627
|
+
'1767', # Sandy
|
628
|
+
#1768 Penrith (Mixed area) (see [4+6]/[4+5] areas)
|
629
|
+
'1769', # South Molton
|
630
|
+
'1770', # Isle of Arran
|
631
|
+
'1771', # Maud
|
215
632
|
'1772', # Preston
|
216
|
-
'
|
633
|
+
'1773', # Ripley
|
634
|
+
'1775', # Spalding
|
635
|
+
'1776', # Stranraer
|
636
|
+
'1777', # Retford
|
637
|
+
'1778', # Market Deeping/Bourne
|
638
|
+
'1779', # Peterhead
|
639
|
+
'1780', # Stamford
|
640
|
+
'1782', # Stoke-on-Trent
|
641
|
+
'1784', # Staines
|
642
|
+
'1785', # Stafford
|
643
|
+
'1786', # Stirling
|
644
|
+
'1787', # Sudbury
|
645
|
+
'1788', # Rugby
|
646
|
+
'1789', # Stratford-upon-Avon
|
647
|
+
'1790', # Spilsby
|
648
|
+
'1792', # Swansea
|
649
|
+
'1793', # Swindon
|
650
|
+
'1794', # Romsey
|
651
|
+
'1795', # Sittingbourne, Sheppey
|
652
|
+
'1796', # Pitlochry
|
653
|
+
'1797', # Rye
|
654
|
+
'1798', # Pulborough, Sussex
|
655
|
+
'1799', # Saffron Walden
|
656
|
+
'1803', # Torquay
|
657
|
+
'1805', # Torrington
|
658
|
+
'1806', # Voe, Shetland
|
659
|
+
'1807', # Ballindalloch, Tomintoul
|
660
|
+
'1808', # Tomatin
|
661
|
+
'1809', # Tomdoun
|
662
|
+
'1821', # Kinrossie, Tayside
|
663
|
+
'1822', # Tavistock
|
664
|
+
'1823', # Taunton
|
665
|
+
'1824', # Ruthin, Vale of Clwyd
|
666
|
+
'1825', # Uckfield
|
667
|
+
#1827 Tamworth (see [4+6]/[4+5] areas)
|
668
|
+
'1828', # Coupar Angus, Tayside
|
669
|
+
'1829', # Tarporley
|
670
|
+
'1830', # Kirkwhelpington
|
671
|
+
'1832', # Clopton, Oundle
|
672
|
+
'1833', # Barnard Castle, Teesdale
|
673
|
+
'1834', # Narberth, Tenby
|
674
|
+
'1835', # St Boswells
|
675
|
+
#1837 Okehampton (see [4+6]/[4+5] areas)
|
676
|
+
'1838', # Dalmally, Tyndrum
|
677
|
+
'1840', # Camelford, Tintagel
|
678
|
+
'1841', # Padstow, Newquay
|
679
|
+
'1842', # Thetford
|
680
|
+
'1843', # Thanet
|
681
|
+
'1844', # Thame
|
682
|
+
'1845', # Thirsk
|
683
|
+
'1847', # Thurso and Tongue (ELNS area)
|
684
|
+
'1848', # Thornhill
|
685
|
+
'1851', # Great Bernera and Stornoway (ELNS area)
|
686
|
+
'1852', # Kilmelford
|
687
|
+
'1854', # Ullapool
|
688
|
+
'1855', # Ballachulish
|
689
|
+
'1856', # Orkney
|
690
|
+
'1857', # Sanday
|
691
|
+
'1858', # Market Harborough
|
692
|
+
'1859', # Harris
|
693
|
+
'1862', # Tain
|
694
|
+
'1863', # Ardgay, Tain
|
695
|
+
'1864', # Tinto, Abington, Crawford
|
696
|
+
'1865', # Oxford
|
697
|
+
'1866', # Kilchrenan
|
698
|
+
'1869', # Bicester, Oxfordshire
|
699
|
+
'1870', # Isle of Benbecula
|
700
|
+
'1871', # Castlebay
|
701
|
+
'1872', # Truro
|
702
|
+
'1873', # Abergavenny, Usk
|
703
|
+
'1874', # Brecon, Usk
|
704
|
+
'1875', # Tranent
|
705
|
+
'1876', # Lochmaddy
|
706
|
+
'1877', # Callander, Trossachs
|
707
|
+
'1878', # Lochboisdale
|
708
|
+
'1879', # Scarinish, Tiree
|
709
|
+
'1880', # Tarbert
|
710
|
+
'1882', # Kinloch Rannoch, Tummel Bridge
|
711
|
+
'1883', # Caterham
|
712
|
+
#1884 Tiverton (see [4+6]/[4+5] areas)
|
713
|
+
'1885', # Pencombe
|
714
|
+
'1886', # Bromyard, Teme Valley
|
715
|
+
'1887', # Aberfeldy, Tay Valley
|
716
|
+
'1888', # Turriff
|
717
|
+
'1889', # Rugeley, Uttoxeter
|
718
|
+
'1890', # Ayton, Berwickshire and Coldstream, Tweed (ELNS area)
|
719
|
+
'1892', # Tunbridge Wells
|
720
|
+
'1895', # Uxbridge
|
721
|
+
'1896', # Galashiels, Tweed
|
722
|
+
'1899', # Biggar, Tweed
|
723
|
+
#1900 Workington (see [4+6]/[4+5] areas)
|
724
|
+
'1902', # Wolverhampton
|
725
|
+
'1903', # Worthing
|
726
|
+
'1904', # York
|
727
|
+
#1905 Worcester (see [4+6]/[4+5] areas)
|
728
|
+
'1908', # Milton Keynes, Wolverton
|
729
|
+
'1909', # Worksop
|
730
|
+
'1920', # Ware
|
731
|
+
'1922', # Walsall
|
732
|
+
'1923', # Watford
|
733
|
+
'1924', # Wakefield
|
734
|
+
'1925', # Warrington
|
735
|
+
'1926', # Warwick
|
736
|
+
'1928', # Runcorn, Warrington
|
737
|
+
'1929', # Wareham
|
738
|
+
'1931', # Shap, Westmorland
|
739
|
+
'1932', # Weybridge
|
740
|
+
'1933', # Wellingborough
|
741
|
+
'1934', # Weston-super-Mare
|
742
|
+
#1935 Yeovil (see [4+6]/[4+5] areas)
|
743
|
+
'1937', # Wetherby
|
744
|
+
'1938', # Welshpool
|
745
|
+
'1939', # Wem
|
746
|
+
'1942', # Wigan
|
747
|
+
'1943', # Guiseley, Wharfedale
|
748
|
+
'1944', # West Heslerton
|
749
|
+
'1945', # Wisbech
|
750
|
+
#1946 Whitehaven (Mixed area) (see [4+6]/[4+5] areas)
|
217
751
|
'1947', # Whitby
|
218
|
-
|
219
|
-
]
|
752
|
+
'1948', # Whitchurch
|
753
|
+
#1949 Whatton (see [4+6]/[4+5] areas)
|
754
|
+
'1950', # Sandwick, Yell
|
755
|
+
'1951', # Colonsay
|
756
|
+
'1952', # Telford, Wellington
|
757
|
+
'1953', # Wymondham
|
758
|
+
'1954', # Madingley, Willingham
|
759
|
+
'1955', # Wick
|
760
|
+
'1957', # Mid Yell, Yell
|
761
|
+
'1959', # Westerham, West Kent
|
762
|
+
'1962', # Winchester
|
763
|
+
#1963 Wincanton (see [4+6]/[4+5] areas)
|
764
|
+
'1964', # Hornsea and Patrington, Withernsea (ELNS area)
|
765
|
+
'1967', # Strontian
|
766
|
+
'1968', # Penicuik, West Linton
|
767
|
+
'1969', # Leyburn, Wensleydale
|
768
|
+
'1970', # Aberystwyth, Ystwyth
|
769
|
+
'1971', # Scourie, Wrath
|
770
|
+
'1972', # Glenborrodale
|
771
|
+
'1974', # Llanon, Ystwyth
|
772
|
+
'1975', # Alford, Aberdeenshire and Strathdon, Water (ELNS area)
|
773
|
+
'1977', # Pontefract, West Riding
|
774
|
+
'1978', # Wrexham
|
775
|
+
'1980', # Amesbury, Wiltshire
|
776
|
+
'1981', # Wormbridge
|
777
|
+
'1982', # Builth Wells
|
778
|
+
'1983', # Isle of Wight
|
779
|
+
'1984', # Watchet, Williton
|
780
|
+
'1985', # Warminster
|
781
|
+
'1986', # Bungay, Waveney
|
782
|
+
'1987', # Ebbsfleet
|
783
|
+
'1988', # Wigtown
|
784
|
+
'1989', # Ross-on-Wye, Wye
|
785
|
+
'1992', # Lea Valley, Waltham Cross
|
786
|
+
'1993', # Witney
|
787
|
+
'1994', # St Clears, West Wales
|
788
|
+
#1995 Garstang, Wyre (see [4+6]/[4+5] areas)
|
789
|
+
'1997', # Strathpeffer, Wyvis
|
790
|
+
]
|
220
791
|
|
221
792
|
Phony.define do
|
222
|
-
country '44', one_of(
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
one_of(
|
228
|
-
|
793
|
+
country '44', one_of(mobile_ndc) >> split(6) | # 4-6
|
794
|
+
one_of(two_digit_ndc) >> split(4,4) | # 2-4-4
|
795
|
+
match(/^([58]00)\d{6}$/) >> split(6) | # 3-6, Special handling for 500 and 800.
|
796
|
+
one_of(three_digit_ndc) >> split(3,4) | # 3-3-4
|
797
|
+
match(/^(16977)\d{4}$/) >> split(4) | # 5-4, Special handling for 16977.
|
798
|
+
one_of(five_digit_ndc) >> split(5) | # 5-5
|
799
|
+
one_of(variable_length_number) >> split(6) | # 4-6 and 4-5, in 40 areas.
|
800
|
+
one_of(four_digit_ndc) >> split(6) | # 4-6
|
801
|
+
fixed(4) >> split(6) # Catchall for undefined numbers.
|
229
802
|
end
|
@@ -547,33 +547,60 @@ describe 'country descriptions' do
|
|
547
547
|
it { Phony.split('256464441234').should == ['256', '464', '441234'] } # Mubende
|
548
548
|
end
|
549
549
|
describe 'The UK' do
|
550
|
-
it { Phony.split('442075671113').should == ['44', '20', '7567', '1113'] } # London
|
551
|
-
it { Phony.split('442920229901').should == ['44', '29', '2022', '9901'] } # Cardiff
|
552
|
-
it { Phony.split('441134770011').should == ['44', '113', '477', '0011'] } # Leeds
|
553
|
-
it { Phony.split('441412770022').should == ['44', '141', '277', '0022'] } # Glasgow
|
554
|
-
it { Phony.split('441204500532').should == ['44', '1204', '500532'] } # Bolton
|
555
|
-
it { Phony.split('44120462532').should == ['44', '1204', '62532'] } # Bolton
|
556
|
-
it { Phony.split('
|
557
|
-
it { Phony.split('
|
558
|
-
it { Phony.split('
|
559
|
-
it { Phony.split('
|
560
|
-
it { Phony.split('
|
561
|
-
it { Phony.split('
|
562
|
-
it { Phony.split('
|
563
|
-
it { Phony.split('
|
564
|
-
it { Phony.split('
|
565
|
-
it { Phony.split('
|
566
|
-
it { Phony.split('
|
567
|
-
it { Phony.split('
|
568
|
-
it { Phony.split('
|
569
|
-
it { Phony.split('
|
550
|
+
it { Phony.split('442075671113').should == ['44', '20', '7567', '1113'] } # [2+8] London
|
551
|
+
it { Phony.split('442920229901').should == ['44', '29', '2022', '9901'] } # [2+8] Cardiff
|
552
|
+
it { Phony.split('441134770011').should == ['44', '113', '477', '0011'] } # [3+7] Leeds
|
553
|
+
it { Phony.split('441412770022').should == ['44', '141', '277', '0022'] } # [3+7] Glasgow
|
554
|
+
it { Phony.split('441204500532').should == ['44', '1204', '500532'] } # [4+6] Bolton
|
555
|
+
it { Phony.split('44120462532').should == ['44', '1204', '62532'] } # [4+5] Bolton
|
556
|
+
it { Phony.split('441333247700').should == ['44', '1333', '247700'] } # [4+6] Leven (Fife)
|
557
|
+
it { Phony.split('441382229845').should == ['44', '1382', '229845'] } # [4+6] Dundee
|
558
|
+
it { Phony.split('441420700378').should == ['44', '1420', '700378'] } # [4+6] Alton
|
559
|
+
it { Phony.split('44142080378').should == ['44', '1420', '80378'] } # [4+5] Alton
|
560
|
+
it { Phony.split('441475724688').should == ['44', '1475', '724688'] } # [4+6] Greenock
|
561
|
+
it { Phony.split('441539248756').should == ['44', '1539', '248756'] } # [4+6] Kendal (Mixed area)
|
562
|
+
it { Phony.split('441539648788').should == ['44', '15396', '48788'] } # [5+5] Sedbergh (Mixed area)
|
563
|
+
it { Phony.split('441652757248').should == ['44', '1652', '757248'] } # [4+6] Brigg
|
564
|
+
it { Phony.split('441664333456').should == ['44', '1664', '333456'] } # [4+6] Melton Mowbray
|
565
|
+
it { Phony.split('441697222555').should == ['44', '1697', '222555'] } # [4+6] Brampton (Mixed area)
|
566
|
+
it { Phony.split('441697388555').should == ['44', '16973', '88555'] } # [5+5] Wigton (Mixed area)
|
567
|
+
it { Phony.split('441697433777').should == ['44', '16974', '33777'] } # [5+5] Raughton Head (Mixed area)
|
568
|
+
it { Phony.split('44169772333').should == ['44', '16977', '2333'] } # [5+4] Brampton (Mixed area)
|
569
|
+
it { Phony.split('441697744888').should == ['44', '16977', '44888'] } # [5+5] Brampton (Mixed area)
|
570
|
+
it { Phony.split('441757850526').should == ['44', '1757', '850526'] } # [4+6] Selby
|
571
|
+
it { Phony.split('441890234567').should == ['44', '1890', '234567'] } # [4+6] Coldstream (ELNS area)
|
572
|
+
it { Phony.split('441890595378').should == ['44', '1890', '595378'] } # [4+6] Ayton (ELNS area)
|
573
|
+
it { Phony.split('441931306526').should == ['44', '1931', '306526'] } # [4+6] Shap
|
574
|
+
it { Phony.split('441946555777').should == ['44', '1946', '555777'] } # [4+6] Whitehaven (Mixed area)
|
575
|
+
it { Phony.split('44194662888').should == ['44', '1946', '62888'] } # [4+5] Whitehaven (Mixed area)
|
576
|
+
it { Phony.split('441946722444').should == ['44', '19467', '22444'] } # [5+5] Gosforth (Mixed area)
|
577
|
+
it { Phony.split('441987705337').should == ['44', '1987', '705337'] } # [4+6] Ebbsfleet
|
578
|
+
it { Phony.split('443005828323').should == ['44', '300', '582', '8323'] } # Non-geographic (NTS)
|
579
|
+
it { Phony.split('443334253344').should == ['44', '333', '425', '3344'] } # Non-geographic (NTS)
|
580
|
+
it { Phony.split('443437658834').should == ['44', '343', '765', '8834'] } # Non-geographic (NTS)
|
581
|
+
it { Phony.split('443452273512').should == ['44', '345', '227', '3512'] } # Non-geographic (NTS)
|
582
|
+
it { Phony.split('443707774444').should == ['44', '370', '777', '4444'] } # Non-geographic (NTS)
|
583
|
+
it { Phony.split('443725247722').should == ['44', '372', '524', '7722'] } # Non-geographic (NTS)
|
584
|
+
it { Phony.split('44500557788').should == ['44', '500', '557788'] } # Freefone (500 + 6)
|
585
|
+
it { Phony.split('445575671113').should == ['44', '55', '7567', '1113'] } # Corporate numbers
|
570
586
|
it { Phony.split('445644775533').should == ['44', '56', '4477', '5533'] } # LIECS/VoIP
|
571
587
|
it { Phony.split('447020229901').should == ['44', '70', '2022', '9901'] } # Personal numbers
|
572
|
-
it { Phony.split('
|
588
|
+
it { Phony.split('447688554246').should == ['44', '76', '8855', '4246'] } # Pager
|
589
|
+
it { Phony.split('447180605207').should == ['44', '7180', '605207'] } # Mobile
|
573
590
|
it { Phony.split('447480605207').should == ['44', '7480', '605207'] } # Mobile
|
574
|
-
it { Phony.split('
|
575
|
-
it { Phony.split('
|
576
|
-
it { Phony.split('
|
591
|
+
it { Phony.split('447624605207').should == ['44', '7624', '605207'] } # Mobile (Isle of Man)
|
592
|
+
it { Phony.split('447780605207').should == ['44', '7780', '605207'] } # Mobile
|
593
|
+
it { Phony.split('447980605207').should == ['44', '7980', '605207'] } # Mobile
|
594
|
+
it { Phony.split('44800557788').should == ['44', '800', '557788'] } # Freefone (800 + 6)
|
595
|
+
it { Phony.split('448084682355').should == ['44', '808', '468', '2355'] } # Freefone (808 + 7)
|
596
|
+
it { Phony.split('448005878323').should == ['44', '800', '587', '8323'] } # Freefone (800 + 7), regression
|
597
|
+
it { Phony.split('448437777334').should == ['44', '843', '777', '7334'] } # Non-geographic (NTS)
|
598
|
+
it { Phony.split('448457777334').should == ['44', '845', '777', '7334'] } # Non-geographic (NTS)
|
599
|
+
it { Phony.split('448707777334').should == ['44', '870', '777', '7334'] } # Non-geographic (NTS)
|
600
|
+
it { Phony.split('448727777334').should == ['44', '872', '777', '7334'] } # Non-geographic (NTS)
|
601
|
+
it { Phony.split('449052463456').should == ['44', '905', '246', '3456'] } # Non-geographic (PRS)
|
602
|
+
it { Phony.split('449122463456').should == ['44', '912', '246', '3456'] } # Non-geographic (PRS)
|
603
|
+
it { Phony.split('449832463456').should == ['44', '983', '246', '3456'] } # Non-geographic (SES)
|
577
604
|
end
|
578
605
|
describe 'US' do
|
579
606
|
it { Phony.split('15551115511').should == ['1', '555', '111', '5511'] }
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
5
|
-
prerelease: 6
|
4
|
+
version: 2.0.0.beta5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Florian Hanke
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-27 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: ! 'Fast international phone number (E164 standard) normalizing, splitting
|
15
14
|
and formatting. Lots of formatting options: International (+.., 00..), national
|
@@ -87,27 +86,26 @@ files:
|
|
87
86
|
- spec/lib/phony_spec.rb
|
88
87
|
homepage: http://github.com/floere/phony
|
89
88
|
licenses: []
|
89
|
+
metadata: {}
|
90
90
|
post_install_message:
|
91
91
|
rdoc_options: []
|
92
92
|
require_paths:
|
93
93
|
- lib
|
94
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
95
|
requirements:
|
97
96
|
- - ! '>='
|
98
97
|
- !ruby/object:Gem::Version
|
99
98
|
version: '0'
|
100
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
-
none: false
|
102
100
|
requirements:
|
103
101
|
- - ! '>'
|
104
102
|
- !ruby/object:Gem::Version
|
105
103
|
version: 1.3.1
|
106
104
|
requirements: []
|
107
105
|
rubyforge_project:
|
108
|
-
rubygems_version:
|
106
|
+
rubygems_version: 2.0.3
|
109
107
|
signing_key:
|
110
|
-
specification_version:
|
108
|
+
specification_version: 4
|
111
109
|
summary: Fast international phone number (E164 standard) normalizing, splitting and
|
112
110
|
formatting.
|
113
111
|
test_files:
|