phony 2.2.11 → 2.2.12
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 +8 -8
- data/lib/phony/countries.rb +4 -2
- data/spec/functional/plausibility_spec.rb +9 -0
- data/spec/lib/phony_spec.rb +7 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDRjN2I3MjBhNGRkMWIxNzI0YTA0ZjcxZTZjYmIzMTQ1YzIzNGNlNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTlkNTNjMTc5YzRjYTVlM2RjMGU4ZTdkYmE4NzkyZWZkMmIxZmI2Mg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2FjNjkxMDQwMzgxZWUzZTBiOGRhYjU5NDJiNGVjZGM1NDg0MWRmZjk0NmY4
|
10
|
+
YWM1ZTFiYzYyMGNlMzViNDhjODE3ZmJjOTMzNmRlMTdmNDMxYTY5ODI0OTFk
|
11
|
+
Y2E4ODYyNzUxZWRkNjY4Yjk0NzU5OGVmNDAyZmFjZTIzNjI1MjA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmU5YmIxYzI2YmIzMDIxMWEzYjM4YjZiMjE2Y2JmYTFiODhmNzkwNDU4NGMy
|
14
|
+
MzBjOGViMTFiMzUzNGVmYzRiNDdlZTNjM2RmYjc3MmRiNDY3YjJjM2M4NTNk
|
15
|
+
MzU4ZjE5ZjhmOGExOGE1ODgyZDExM2M4N2Q3MTI5NmE4MWQ1ODk=
|
data/lib/phony/countries.rb
CHANGED
@@ -212,8 +212,10 @@ Phony.define do
|
|
212
212
|
# New Zealand.
|
213
213
|
#
|
214
214
|
country '64',
|
215
|
-
match(/^(2\d)\d
|
216
|
-
|
215
|
+
match(/^(2\d)\d{7}$/) >> split(3,4) | # Mobile
|
216
|
+
match(/^(2\d)\d{6}$/) >> split(3,3) |
|
217
|
+
match(/^(2\d)\d{8}$/) >> split(2,3,3) |
|
218
|
+
fixed(1) >> split(3,4) # Rest
|
217
219
|
|
218
220
|
# Singapore (Republic of).
|
219
221
|
#
|
@@ -358,6 +358,15 @@ describe 'plausibility' do
|
|
358
358
|
Phony.plausible?('+599 12345678').should be_false # too long
|
359
359
|
end
|
360
360
|
|
361
|
+
it 'is correct for New Zeland' do
|
362
|
+
Phony.plausible?('+64 21 123 456').should be_true
|
363
|
+
Phony.plausible?('+64 21 123 4567').should be_true
|
364
|
+
Phony.plausible?('+64 9 379 1234').should be_true
|
365
|
+
Phony.plausible?('+64 21 12 345 678').should be_true
|
366
|
+
Phony.plausible?('+64 21 1234 56789').should be_false # to long
|
367
|
+
Phony.plausible?('+64 21 12345').should be_false # to short
|
368
|
+
end
|
369
|
+
|
361
370
|
it 'is correct for Nigerian numbers' do
|
362
371
|
Phony.plausible?('+234 807 766 1234').should be_true
|
363
372
|
Phony.plausible?('+234 807 766 123').should be_false
|
data/spec/lib/phony_spec.rb
CHANGED
@@ -133,9 +133,15 @@ describe Phony do
|
|
133
133
|
it 'should format american numbers' do
|
134
134
|
Phony.format('18705551122').should eql '+1 870 555 1122'
|
135
135
|
end
|
136
|
-
it 'should format New Zealand 021 mobile numbers' do
|
136
|
+
it 'should format New Zealand 021 6-digit mobile numbers' do
|
137
|
+
Phony.format('6421123456').should eql '+64 21 123 456'
|
138
|
+
end
|
139
|
+
it 'should format New Zealand 021 7-digit mobile numbers' do
|
137
140
|
Phony.format('64211234567').should eql '+64 21 123 4567'
|
138
141
|
end
|
142
|
+
it 'should format New Zealand 021 8-digit mobile numbers' do
|
143
|
+
Phony.format('642112345678').should eql '+64 21 12 345 678'
|
144
|
+
end
|
139
145
|
it 'should format New Zealand landline numbers' do
|
140
146
|
Phony.format('6493791234').should eql '+64 9 379 1234'
|
141
147
|
end
|
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.2.
|
4
|
+
version: 2.2.12
|
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-05-
|
11
|
+
date: 2014-05-26 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
|