phony 2.19.7 → 2.19.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f544b11a7d8e0f28ee13fc67d92fb3cd5a98f968ccfce3cb60b7781bc761fba5
4
- data.tar.gz: cec200536113d42a5c6822c7d8e636b925a8c48ee062fc5ef99143548eb7cc13
3
+ metadata.gz: c0fc7753788d596736d26fddf4ff8688d33348e45512f3edea923b8fb35afa7c
4
+ data.tar.gz: 570d9d1012de2b6a854bafc238e385619365b4a559cea14f321ded2f0644c851
5
5
  SHA512:
6
- metadata.gz: b4e9ac3559aa37f477e87e453c1316d12636fbedac8d9ae9f0e66e9af378009265abdf93882a159bfe6f42af2235e68a5cb55ec116593d2714de40b45c2c0d31
7
- data.tar.gz: ed1fd348d0d1951c4de48ed8d7fca4f10c35f91d2a08b223d5fa14cbbf144c1d96a4d30e2c45af230760ad4733bbd9c053aded4f1c1052ed7ef618e6ef67dfab
6
+ metadata.gz: b22cf9c9b8bffe3222333461c919b5a04fab9b4d7f111c0679b79e602787a262b0716a432affa4b1a35710ab26e188f947420dcf35a7b893ae7af22e58d0e4c5
7
+ data.tar.gz: '008fcad42c6dec3854a15b6dfe9d4856b5a26950cd8a9bfa4495d056159dd0dc9b3e77320380e97350fd7d6ec7886af542c6435da21771c12889f82cbac6a962'
@@ -493,22 +493,24 @@ Phony.define do
493
493
  match(/^(800)/) >> split(3,3) | # Toll free
494
494
  match(/^(21[1-8])/) >> split(6) # Fixed
495
495
 
496
- # Madagascar http://www.wtng.info/wtng-261-mg.html
496
+ # Madagascar
497
+ # https://en.wikipedia.org/wiki/Telephone_numbers_in_Madagascar
497
498
  # http://www.itu.int/oth/T020200007F/en
498
499
  country '261',
499
- none >> matched_split(
500
- /\A200\d+\z/ => [2,3,3,3], # Telecom Malagasy (Telma)
501
- /\A20\d+\z/ => [2,3,4], # Telecom Malagasy (Telma)
502
- /\A23\d+\z/ => [2,3,4], # Digitel
503
- /\A30\d+\z/ => [2,3,4], # mobile Madamobil (CDMA2000)
504
- /\A31\d+\z/ => [2,3,4], # mobile Airtel Madagascar
505
- /\A32\d+\z/ => [2,3,4], # mobile Orange Madagascar
506
- /\A33\d+\z/ => [2,3,4], # mobile Airtel Madagascar
507
- /\A34\d+\z/ => [2,3,4], # mobile Telecom Malagasy (Telma)
508
- /\A5\d+\z/ => [3,3,3], # pager
509
- /\A22\d+\z/ => [3,3,3], # satellite GULFSAT Téléphonie
510
- /\A6\d+\z/ => [3,3,3] # satellite
511
- )
500
+ # none >> matched_split(
501
+ # /\A20\d+\z/ => [2,2,3,2], # Telecom Malagasy (Telma)
502
+ # /\A32\d+\z/ => [2,2,3,2], # mobile Orange Madagascar
503
+ # /\A33\d+\z/ => [2,2,3,2], # mobile Airtel Madagascar
504
+ # /\A34\d+\z/ => [2,2,3,2], # mobile Telecom Malagasy (Telma)
505
+ # /\A38\d+\z/ => [2,2,3,2], # mobile Telecom Malagasy (Telma)
506
+ # /\A39\d+\z => [2,2,3,2] # mobile Blueline
507
+ # ),
508
+ match(/\A(20)\d+\z/) >> split(2,3,2) | # fix Telecom Malagasy (Telma)
509
+ match(/\A(32)\d+\z/) >> split(2,3,2) | # mobile Orange Madagascar
510
+ match(/\A(33)\d+\z/) >> split(2,3,2) | # mobile Airtel Madagascar
511
+ match(/\A(34)\d+\z/) >> split(2,3,2) | # mobile Telecom Malagasy (Telma)
512
+ match(/\A(38)\d+\z/) >> split(2,3,2) | # mobile Telecom Malagasy (Telma)
513
+ match(/\A(39)\d+\z/) >> split(2,3,2) # mobile Blueline Madagascar
512
514
 
513
515
  country '262', # Reunion / Mayotte (new) http://www.wtng.info/wtng-262-fr.html
514
516
  trunk('0') |
@@ -324,10 +324,19 @@ describe 'plausibility' do
324
324
  it_is_correct_for 'Macedonia', :samples => ['+389 2 123 4567',
325
325
  '+389 7 124 3456',
326
326
  '+389 7 234 5678']
327
- it_is_correct_for 'Madagascar', :samples => ['+261 20 012 345 678',
328
- '+261 20 124 3456',
329
- '+261 512 345 678',
330
- '+261 33 345 6789']
327
+ it_is_correct_for 'Madagascar', :samples => ['+261 20 23 456 78',
328
+ '+261 32 34 546 78',
329
+ '+261 33 34 546 78',
330
+ '+261 34 34 546 78',
331
+ '+261 38 34 546 78']
332
+ it 'is incorrect for Madagascar' do
333
+ Phony.plausible?('+261 20 012 345 678').should be_falsey
334
+ Phony.plausible?('+261 20 12 434 569').should be_falsey
335
+ Phony.plausible?('+261 51 23 4567 8').should be_falsey
336
+ Phony.plausible?('+261 34 345 46789').should be_falsey
337
+ Phony.plausible?('+261 34 345 467').should be_falsey
338
+ end
339
+
331
340
  it_is_correct_for 'Malawi', :samples => ['+265 1725 123',
332
341
  '+265 213 456 789',
333
342
  '+265 9123 456',
@@ -1053,9 +1053,10 @@ describe 'country descriptions' do
1053
1053
  it_splits '218911234456', %w(218 91 1234 456)
1054
1054
  end
1055
1055
  describe 'Madagascar' do
1056
- it_splits '26120012345678', ['261', false, '20', '012', '345', '678']
1057
- it_splits '261201243456', ['261', false, *%w(20 124 3456)]
1058
- it_splits '261512345678', ['261', false, *%w(512 345 678)]
1056
+ it_splits '261202254716', ['261', '20', *%w(22 547 16)]
1057
+ it_splits '261320254716', ['261', '32', *%w(02 547 16)]
1058
+ it_splits '261330254716', ['261', '33', *%w(02 547 16)]
1059
+ it_splits '261340254716', ['261', '34', *%w(02 547 16)]
1059
1060
  end
1060
1061
  describe 'Malawi' do
1061
1062
  it_splits '2651725123', ['265', false, '1725', '123']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phony
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.19.7
4
+ version: 2.19.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Hanke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-16 00:00:00.000000000 Z
11
+ date: 2022-01-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'Fast international phone number (E164 standard) normalizing, splitting
14
14
  and formatting. Lots of formatting options: International (+.., 00..), national