phony 2.8.5 → 2.8.6

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
  SHA1:
3
- metadata.gz: ddd6173b7d716c058faa71d0ea7a4d088b489bc0
4
- data.tar.gz: 21cc4457bf280d3c4bbca640b976de2a695532ee
3
+ metadata.gz: fd5cdb06a66334890f3ff3b0112b3324ebfab8a6
4
+ data.tar.gz: 648a338a8a86a3ed26760be57e2975ae72493021
5
5
  SHA512:
6
- metadata.gz: e14dd407726870e5cbcbc1ce07ed384bf9b6a15b91d0aa31349d0916c98de54407344b3f9b6cc68d9aaea915eb90b78b7c57a5a0c201119a62d0c5fbeedd6a25
7
- data.tar.gz: 2d71adbb380bee99f155f75b4f46517005553330985a5aadb906bc5ccab034c02aab30e6c263ed96a5351e114fc3764aa74f03362a925718e38261cb58519561
6
+ metadata.gz: b51d7021c27867e0cc359378c58038ee962f1445962a8c6990d0cfcc45cd1cafed4604834a862700a5644021be7109a37d5f512f27b529fa9b860192eb4dd1bc
7
+ data.tar.gz: 73608bb4ad43b3db4239b3769ea8c979f568811c5114224a6153e5df59fb3579a0da81805579378627af1ac32bc3e7216dd9ad270c1446a5def037d279aa98bb
@@ -158,10 +158,14 @@ Phony.define do
158
158
 
159
159
  # Mexico.
160
160
  #
161
+ # http://en.wikipedia.org/wiki/Telephone_numbers_in_Mexico
162
+ # http://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers#Mexico
161
163
  country '52',
162
- match(/^(0\d{2})\d+$/) >> split(2,2,2,2) |
163
- match(/^(33|55|81)\d+$/) >> split(2,2,2,2) |
164
- match(/^(\d{3})\d+$/) >> split(3,2,2) # catchall.
164
+ match(/^(0\d{1,2})\d{10}$/) >> split(3,3,4) | # prefixed numbers from within Mexico (e.g. 045 + 10 digits or 02 + 10 digits)
165
+ match(/^(1)(33|55|81)\d{8}$/) >> split(2,4,4) | # Mexico D.F, Guadalajara, Monterrey cell phone from abroad (e.g. 52 1 55 xxxx xxxx)
166
+ match(/^(33|55|81)\d{8}$/) >> split(4,4) | # Mexico D.F, Guadalajara, Monterrey from within Mexico
167
+ match(/^(1)(\d{3})\d{7}$/) >> split(3,3,4) | # cell phone from abroad
168
+ match(/^(\d{3})\d{7}$/) >> split(3,4) # catchall.
165
169
 
166
170
  # Cuba.
167
171
  #
@@ -426,6 +426,16 @@ describe 'plausibility' do
426
426
  Phony.plausible?('+60 14 1234 12345').should be_false # too long
427
427
  end
428
428
 
429
+ it 'is correct for Mexico' do
430
+ Phony.plausible?('+52 1 55 1212 1212').should be_true
431
+ Phony.plausible?('+52 55 1212 1212').should be_true
432
+ Phony.plausible?('+52 664 123 1212').should be_true
433
+ Phony.plausible?('+52 1 664 123 1212').should be_true
434
+ Phony.plausible?('+52 044 664 123 1212').should be_true
435
+ Phony.plausible?('+52 1 55 1212 1212 3').should be_false # too long
436
+ Phony.plausible?('+52 55 1212 121').should be_false # too short
437
+ end
438
+
429
439
  it "is correct for Netherlands Antilles" do
430
440
  Phony.plausible?('+599 1234567').should be_true
431
441
  Phony.plausible?('+599 123456').should be_false # too short
@@ -426,8 +426,11 @@ describe 'country descriptions' do
426
426
  it_splits '35651231234', ['356', '5123', '1234'] # Voice Mail
427
427
  end
428
428
  describe 'Mexico' do
429
- it_splits '525512121212', ['52', '55', '12', '12', '12', '12'] # Mexico City
430
- it_splits '526641231212', ['52', '664', '123', '12', '12'] # Tijuana
429
+ it_splits '525512121212', ['52', '55', '1212', '1212'] # Mexico City
430
+ it_splits '5215512121212', ['52', '1', '55', '1212', '1212'] # Mexico City cell phone from abroad
431
+ it_splits '526641231212', ['52', '664', '123', '1212'] # Tijuana
432
+ it_splits '5216641231212', ['52', '1', '664', '123', '1212'] # Tijuana cell phone from abroad
433
+ it_splits '520446641231212', ['52', '044', '664', '123', '1212'] # Tijuana cell phone local from landline
431
434
  end
432
435
  describe 'Monaco' do
433
436
  it_splits '37741123456', ['377', '41', '12', '34', '56'] # Mobile
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.8.5
4
+ version: 2.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Hanke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-03 00:00:00.000000000 Z
11
+ date: 2014-12-08 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