Permalink
Browse files

+ added Morocco & Sudan

  • Loading branch information...
1 parent 3451373 commit 727c19630bf3b8870d38e49c6f8798d7d9081156 @jcfischer jcfischer committed Sep 11, 2012
Showing with 9 additions and 3 deletions.
  1. +1 −1 README.textile
  2. +2 −2 lib/phony/countries.rb
  3. +6 −0 spec/lib/phony/countries_spec.rb
View
@@ -13,7 +13,7 @@ This gem can normalize, format and split E164 numbers.
The (admittedly crazy) *goal* of this Gem is to be able to format/split all phone numbers in the world.
-Currently handles Abhas, Afghan, Algerian, Austrian, Australian, Belgian, Brazilian, Chilean, Chinese, Croatian, Cuban, Czech, Danish, Dutch, Egyptian, French, German, Ghanan, Greek, Hungarian, Italian, Irish, Kazakh, Lithuanian, Luxembourgian, Malaysian, Mexican, New Zealand, Nigerian, Norwegian, Peruvian, Polish, Romanian, Russian, Singapore, Slovakian, South African, South Korean, South Osetian, Spanish, Swedish, Swiss, Thailand, Tunisian, Turkish, Liechtenstein, UK, US, Venezuelan, and Vietnamese numbers.
+Currently handles Abhas, Afghan, Algerian, Austrian, Australian, Belgian, Brazilian, Chilean, Chinese, Croatian, Cuban, Czech, Danish, Dutch, Egyptian, French, German, Ghanan, Greek, Hungarian, Italian, Irish, Kazakh, Lithuanian, Luxembourgian, Malaysian, Mexican, Morocco, New Zealand, Nigerian, Norwegian, Peruvian, Polish, Romanian, Russian, Singapore, Slovakian, South African, South Korean, South Osetian, Spanish, Sudan, Swedish, Swiss, Thailand, Tunisian, Turkish, Liechtenstein, UK, US, Venezuelan, and Vietnamese numbers.
And to some extent, all others. Just try if it works for you.
If it doesn't, please "enter an issue":http://github.com/floere/phony/issues.
@@ -242,7 +242,7 @@
country '210', todo # -
country '211', todo # South Sudan
- country '212', todo # Morocco
+ country '212', fixed(2) >> split(4,3) # Morocco
country '213', fixed(2) >> split(3,4) # Algeria
country '214', todo # -
country '215', todo # -
@@ -297,7 +297,7 @@
country '246', todo # Diego Garcia
country '247', none >> split(4) # Ascension
country '248', todo # Seychelles
- country '249', todo # Sudan
+ country '249', fixed(2) >> split(3,4) # Sudan
country '250', todo # Rwanda
country '251', todo # Ethiopia
@@ -160,6 +160,9 @@ def self.it_splits number, expected
it_splits '525512121212', ['52', '55', '12', '12', '12', '12'] # Mexico City
it_splits '526641231212', ['52', '664', '123', '12', '12'] # Tijuana
end
+ describe 'Morocco' do
+ it_splits '212537718685', ['212', '53', '7718', '685']
+ end
describe 'The Netherlands' do
it_splits '31612345678', ['31', '6', '12345678'] # mobile
it_splits '31201234567', ['31', '20', '1234567']
@@ -212,6 +215,9 @@ def self.it_splits number, expected
it { Phony.split('821027975588').should == ['82', '10', '2797', '5588'] } # mobile
it { Phony.split('821087971234').should == ['82', '10', '8797', '1234'] } # mobile
end
+ describe 'Sudan' do
+ it_splits '249187171100', ['249', '18', '717', '1100']
+ end
describe 'Thailand' do
it { Phony.split('6621231234').should == ['66', '2', '123', '1234'] } # Bangkok
it { Phony.split('6636123123').should == ['66', '36', '123', '123'] } # Lop Buri

0 comments on commit 727c196

Please sign in to comment.