phony 1.8.5 → 1.8.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -295,17 +295,22 @@ Phony.define do
295
295
  country '248', todo # Seychelles
296
296
  country '249', fixed(2) >> split(3,4) # Sudan
297
297
 
298
- # Rwanda
299
- # http://en.wikipedia.org/wiki/Telephone_numbers_in_Rwanda
298
+ # Rwanda
299
+ # http://en.wikipedia.org/wiki/Telephone_numbers_in_Rwanda
300
300
  country '250',
301
- one_of('25') >> split(7) | # Geographic, fixed
302
- match(/^(7[238])/) >> split(7) | # Non-geographic, mobile
303
- one_of('06') >> split(6) # Satellite
301
+ one_of('25') >> split(7) | # Geographic, fixed
302
+ match(/^(7[238])/) >> split(7) | # Non-geographic, mobile
303
+ one_of('06') >> split(6) # Satellite
304
304
 
305
305
  country '251', todo # Ethiopia
306
306
  country '252', todo # Somali Democratic Republic
307
307
  country '253', todo # Djibouti
308
- country '254', fixed(2) >> split(7) # Kenya
308
+
309
+ # Kenya
310
+ # http://en.wikipedia.org/wiki/Telephone_numbers_in_Kenya
311
+ country '254',
312
+ match(/^(7\d\d)/) >> split(6) | # mobile
313
+ fixed(2) >> split(7) # landline
309
314
 
310
315
  # Tanzania.
311
316
  #
@@ -324,7 +329,12 @@ Phony.define do
324
329
  country '258', todo # Mozambique
325
330
  country '259', todo # -
326
331
 
327
- country '260', todo # Zambia
332
+ # Zambia
333
+ # http://en.wikipedia.org/wiki/Telephone_numbers_in_Zambia
334
+ country '260',
335
+ match(/^(9[567])/) >> split(7) | # Mobile
336
+ match(/^(21[1-8])/) >> split(6) # Geographic
337
+
328
338
  country '261', todo # Madagascar
329
339
  country '262', todo # Reunion / Mayotte (new)
330
340
  country '263', todo # Zimbabwe
@@ -360,8 +370,8 @@ Phony.define do
360
370
  # Gibraltar
361
371
  country '350',
362
372
  match(/^(2[012]\d)\d+$/) >> split(5) | # fixed
363
- match(/^([56]\d)\d+$/) >> split(6) | # mobile
364
- match(/^(8\d\d\d)$/) >> split(0)
373
+ match(/^([56]\d)\d+$/) >> split(6) | # mobile
374
+ match(/^(8\d\d\d)$/) >> split(0)
365
375
 
366
376
  # Portugal.
367
377
  #
@@ -374,11 +384,11 @@ Phony.define do
374
384
  # Luxembourg
375
385
  #
376
386
  country '352',
377
- one_of('4') >> split(2,2,2) | # Luxembourg City
378
- match(/^(2[467]\d{2})$/) >> split(2,2,2) | # 4-digit NDC
379
- match(/^(6\d[18])\d+$/) >> split(3,3) | # mobile
380
- match(/^(60\d{2})\d{8}$/) >> split(2,2,2,2) | # mobile machine to machine
381
- match(/^([2-9]\d)/) >> split(2,2,2) # 2-digit NDC
387
+ one_of('4') >> split(2,2,2) | # Luxembourg City
388
+ match(/^(2[467]\d{2})$/) >> split(2,2,2) | # 4-digit NDC
389
+ match(/^(6\d[18])\d+$/) >> split(3,3) | # mobile
390
+ match(/^(60\d{2})\d{8}$/) >> split(2,2,2,2) | # mobile machine to machine
391
+ match(/^([2-9]\d)/) >> split(2,2,2) # 2-digit NDC
382
392
 
383
393
  # country '353' # Republic of Ireland, see special file.
384
394
 
@@ -165,6 +165,7 @@ describe 'country descriptions' do
165
165
  describe 'Kenya' do
166
166
  it_splits '254201234567', ['254', '20', '1234567'] # Nairobi
167
167
  it_splits '254111234567', ['254', '11', '1234567'] # Mombasa
168
+ it_splits '254723100220', ['254', '723', '100220'] # Mombasa
168
169
  end
169
170
  describe 'Lithuania' do
170
171
  it_splits '37070012123', ['370', '700', '12', '123'] # Service
@@ -343,6 +344,10 @@ describe 'country descriptions' do
343
344
  it { Phony.split('8499612345').should == ['84', '996', '12345'] } # GTel
344
345
  it { Phony.split('8441234567').should == ['84', '4', '1234567'] } # Hanoi
345
346
  end
347
+ describe 'Zambia' do
348
+ it_splits '260977640895', ['260', '97', '7640895'] # mobile
349
+ it_splits '260211229049', ['260', '211', '229049'] # fixed
350
+ end
346
351
  describe 'New Zealand' do
347
352
  it { Phony.split('6491234567').should == ['64', '9', '123', '4567'] }
348
353
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phony
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.5
4
+ version: 1.8.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-21 00:00:00.000000000 Z
12
+ date: 2013-02-05 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'Fast international phone number (E164 standard) normalizing, splitting
15
15
  and formatting. Lots of formatting options: International (+.., 00..), national