phony 2.19.7 → 2.19.8
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 +4 -4
- data/lib/phony/countries.rb +16 -14
- data/spec/functional/plausibility_spec.rb +13 -4
- data/spec/lib/phony/countries_spec.rb +4 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0fc7753788d596736d26fddf4ff8688d33348e45512f3edea923b8fb35afa7c
|
4
|
+
data.tar.gz: 570d9d1012de2b6a854bafc238e385619365b4a559cea14f321ded2f0644c851
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b22cf9c9b8bffe3222333461c919b5a04fab9b4d7f111c0679b79e602787a262b0716a432affa4b1a35710ab26e188f947420dcf35a7b893ae7af22e58d0e4c5
|
7
|
+
data.tar.gz: '008fcad42c6dec3854a15b6dfe9d4856b5a26950cd8a9bfa4495d056159dd0dc9b3e77320380e97350fd7d6ec7886af542c6435da21771c12889f82cbac6a962'
|
data/lib/phony/countries.rb
CHANGED
@@ -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
|
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
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
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
|
328
|
-
'+261
|
329
|
-
'+261
|
330
|
-
'+261
|
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 '
|
1057
|
-
it_splits '
|
1058
|
-
it_splits '
|
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.
|
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:
|
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
|