phony 1.7.0 → 1.7.1
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.
- data/lib/phony/countries.rb +7 -6
- data/lib/phony/country_codes.rb +3 -0
- data/spec/lib/phony/countries_spec.rb +5 -1
- metadata +1 -1
data/lib/phony/countries.rb
CHANGED
@@ -121,7 +121,8 @@ Phony.define do
|
|
121
121
|
# Note: http://wapedia.mobi/en/Telephone_numbers_in_Poland, mobile not yet correct
|
122
122
|
#
|
123
123
|
country '48',
|
124
|
-
|
124
|
+
match(/^(5[013]\d|6[069]\d|7[02389]\d|80[01]|88\d)/) >> split(3,3) |
|
125
|
+
fixed(2) >> split(3,2,2)
|
125
126
|
|
126
127
|
# country '49' # Germany, see special file.
|
127
128
|
|
@@ -186,7 +187,7 @@ Phony.define do
|
|
186
187
|
country '61',
|
187
188
|
match(/^(4\d\d)\d+$/) >> split(3,3) | # Mobile
|
188
189
|
fixed(1) >> split(4,4) # Rest
|
189
|
-
|
190
|
+
|
190
191
|
country '62', todo # TODO Indonesia (Republic of)
|
191
192
|
country '63', todo # TODO Philippines (Republic of the)
|
192
193
|
|
@@ -216,7 +217,7 @@ Phony.define do
|
|
216
217
|
one_of('4', '8') >> split(7) |
|
217
218
|
match(/^(2[025679]|3[0136789]|5[23456789]|6[01234678]|7[02345679]|9[0-8])\d/) >> split(6) |
|
218
219
|
fixed(3) >> split(5)
|
219
|
-
|
220
|
+
|
220
221
|
|
221
222
|
# country '86' # China, see special file.
|
222
223
|
|
@@ -293,7 +294,7 @@ Phony.define do
|
|
293
294
|
country '252', todo # Somali Democratic Republic
|
294
295
|
country '253', todo # Djibouti
|
295
296
|
country '254', fixed(2) >> split(7) # Kenya
|
296
|
-
|
297
|
+
|
297
298
|
# Tanzania.
|
298
299
|
#
|
299
300
|
country '255',
|
@@ -306,7 +307,7 @@ Phony.define do
|
|
306
307
|
country '256',
|
307
308
|
match(/^(46[45]|4[78]\d)/) >> split(6) | # Geo 1.
|
308
309
|
fixed(2) >> split(7) # Geo 2.
|
309
|
-
|
310
|
+
|
310
311
|
country '257', todo # Burundi
|
311
312
|
country '258', todo # Mozambique
|
312
313
|
country '259', todo # -
|
@@ -370,7 +371,7 @@ Phony.define do
|
|
370
371
|
match(/^(4\d|50)\d+$/) >> split(3,2,2) | # Mobile
|
371
372
|
one_of('2','3','5','6','8','9') >> split(3,3) | # Short NDCs
|
372
373
|
fixed(2) >> split(3,3) # 2-digit NDCs
|
373
|
-
|
374
|
+
|
374
375
|
# Bulgaria.
|
375
376
|
#
|
376
377
|
country '359',
|
data/lib/phony/country_codes.rb
CHANGED
@@ -164,7 +164,11 @@ describe 'country descriptions' do
|
|
164
164
|
Phony.split('51841234123').should == ['51', '84', '1234', '123'] # Cuzco, best effort
|
165
165
|
end
|
166
166
|
it 'handles polish numbers' do
|
167
|
-
Phony.split('
|
167
|
+
Phony.split('48123456789').should == ['48', '12', '345', '67', '89'] # Landline
|
168
|
+
Phony.split('48501123456').should == ['48', '501', '123', '456'] # Mobile
|
169
|
+
Phony.split('48800123456').should == ['48', '800', '123', '456'] # Free
|
170
|
+
Phony.split('48801123456').should == ['48', '801', '123', '456'] # Shared cost
|
171
|
+
Phony.split('48701123456').should == ['48', '701', '123', '456'] # Premium
|
168
172
|
end
|
169
173
|
it 'handles portuguese numbers' do
|
170
174
|
Phony.split('351211231234').should == ['351', '21', '123', '1234'] # Lisboa
|