Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

+ Salaam, Afghanistan!, . various edits

  • Loading branch information...
commit 3d82bb2a63cc452b53293f877c4f0b28e4e72aa6 1 parent 74333d3
@floere authored
View
2  README.textile
@@ -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
View
4 lib/phony/countries/all_other.rb
@@ -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 spec/lib/phony_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.