Permalink
Browse files

+ Polish numbers :)

  • Loading branch information...
1 parent 29ea6bb commit 0fa7caaede9459397411bc0b4e793033dcca7c52 @floere committed Nov 19, 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 AT, CH, DE, FR, LI, US numbers.
+Currently handles Austrian, Australian, Belgian, Czech, Egyptian, French, German, Greek, Hungarian, Italian, New Zealand, Norwegian, Polish, Russian, South African, Spanish, Swiss, Liechtenstein, US numbers.
And to some extend, all others. Just try if it works for you.
h2. Installation
@@ -80,7 +80,9 @@ def self.mapping
'47' => fixed(4, # Norway
:local_format => [4]
),
- '48' => fixed(2), # Poland (Republic of)
+ '48' => fixed(2, # Poland (Republic of)
+ :local_format => [1, 3, 3] # Approximation. Correct would be 48-xxx-xxx-xxx
+ ),
'49' => Countries::Germany,
'51' => fixed(2), # Peru
View
@@ -23,9 +23,12 @@
it "should handle hungarian numbers" do
Phony.split('3612345678').should == ['36', '1', '234', '5678']
end
- it "should handle italian numbers opinionatedly" do
+ it "should handle italian numbers" do
Phony.split('3928061371').should == ['39', '2', '806', '1371']
end
+ it "should handle polish numbers" do
+ Phony.split('48121123123').should == ['48', '12', '1', '123', '123']
+ end
it "should handle swiss numbers" do
Phony.split('41443643532').should == ['41', '44', '364', '35', '32']
end

2 comments on commit 0fa7caa

Contributor

andi replied Nov 20, 2010

Yeah, this rocks! I like this gem! :-)

Owner

floere replied Nov 21, 2010

Thanks! It's a complete rewrite of you-know-what ;)

Please sign in to comment.