Permalink
Browse files

+ Salaam, Afghanistan!, . various edits

  • Loading branch information...
1 parent 74333d3 commit 3d82bb2a63cc452b53293f877c4f0b28e4e72aa6 @floere committed Dec 8, 2010
Showing with 8 additions and 3 deletions.
  1. +1 −1 README.textile
  2. +3 −1 lib/phony/countries/all_other.rb
  3. +4 −1 spec/lib/phony_spec.rb
View
@@ -5,7 +5,7 @@ h2. Description
This gem can normalize, format and split E164 numbers.
"More about E164 numbers in this Wiki":http://en.wikipedia.org/wiki/E.164.
-Currently handles Austrian, Australian, Belgian, Czech, Egyptian, French, German, Greek, Hungarian, Italian, (The) Netherlands, New Zealand, Norwegian, Polish, Russian, South African, Spanish, Swiss, Liechtenstein, US numbers.
+Currently handles Afghan, Austrian, Australian, Belgian, Brazilian, Chilean, Czech, Danish, Dutch, Egyptian, French, German, Greek, Hungarian, Italian, (The) Netherlands, New Zealand, Norwegian, Peruvian, Polish, Russian, Romanian, South African, Spanish, Swedish, Swiss, Liechtenstein, US, Venezuelan numbers.
And to some extend, all others. Just try if it works for you.
h2. Installation
@@ -121,7 +121,9 @@ def self.mapping
'90' => fixed(2), # TODO Turkey
'91' => fixed(2), # TODO India (Republic of)
'92' => fixed(2), # TODO Pakistan (Islamic Republic of)
- '93' => fixed(2), # TODO Afghanistan
+ '93' => fixed(2, # Afghanistan
+ :local_format => [7] # Actually, the document says 6, but the examples use 7.
+ ), # http://www.wtng.info/wtng-93-af.html
'94' => fixed(2), # TODO Sri Lanka (Democratic Socialist Republic of)
'95' => fixed(2), # TODO Myanmar (Union of)
'98' => fixed(2), # TODO Iran (Islamic Republic of)
View
@@ -5,6 +5,9 @@
describe Phony do
describe "split" do
+ it 'handles afghan numbers' do
+ Phony.split('93201234567').should == ['93', '20', '1234567'] # Kabul
+ end
it "should handle austrian numbers" do
Phony.split('43198110').should == ['43', '1', '98110']
end
@@ -13,7 +16,7 @@
end
it 'handles chilean numbers' do
Phony.split('5621234567').should == ['56', '2', '1234567'] # Santiago
- Phony.split('5675123456').should == ['56', '75', '123456'] # Curico
+ Phony.split('5675123456').should == ['56', '75', '123456'] # Curico
Phony.split('56912345678').should == ['56', '9', '12345678'] # mobile
end
it 'handles danish numbers' do

0 comments on commit 3d82bb2

Please sign in to comment.