Skip to content
Browse files

+ added HongKong

  • Loading branch information...
1 parent c31517e commit 1e2134acbafd5410de3ef649a8851924e96c7d05 @jcfischer jcfischer committed with Dec 4, 2012
Showing with 13 additions and 3 deletions.
  1. +1 −1 README.textile
  2. +8 −2 lib/phony/countries.rb
  3. +4 −0 spec/lib/phony/countries_spec.rb
View
2 README.textile
@@ -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, Cambodian, Chilean, Chinese, Croatian, Cuban, Cypriot, Czech, Danish, Dutch, Egyptian, Estonian, French, German, Ghanan, Gibraltar, Greek, Hungarian, Italian, Irish, Kazakh, Lithuanian, Luxembourgian, Malaysian, Malta, Mexican, Monaco, Morocco, New Zealand, Nigerian, Norwegian, Peruvian, Polish, Romanian, Russian, Rwandan, Singapore, Slovakian, South African, South Korean, South Osetian, Spanish, Sudan, Swedish, Swiss, Thailand, Tunisian, Turkish, Liechtenstein, UK, US, Venezuelan, and Vietnamese numbers.
+Currently handles Abhas, Afghan, Algerian, Austrian, Australian, Belgian, Brazilian, Cambodian, Chilean, Chinese, Croatian, Cuban, Cypriot, Czech, Danish, Dutch, Egyptian, Estonian, French, German, Ghanan, Gibraltar, Greek, Hong Kong, Hungarian, Italian, Irish, Kazakh, Lithuanian, Luxembourgian, Malaysian, Malta, Mexican, Monaco, Morocco, New Zealand, Nigerian, Norwegian, Peruvian, Polish, Romanian, Russian, Rwandan, 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.
View
10 lib/phony/countries.rb
@@ -37,7 +37,7 @@
# invalid_ndcs('911'), # /911/ would also work.
[invalid_ndcs('911'), validate_lengths(10)]
- # Kazakhstan (Republic of) & Russian Federation.
+ # Kazakhstan (Republic of) & Russsian Federation.
# also Abhasia and South Osetia autonomous regions / recognized by some states as independent countries
#country '7', fixed(3) >> split(3,2,2)
# see special file
@@ -604,7 +604,13 @@
country '850', todo # Democratic People's Republic of Korea
country '851', todo # Spare code
- country '852', todo # Hong Kong, China
+
+ # Hong Kong, China
+
+ country '852',
+ none >> split(4,4),
+ validate_lengths(8)
+
country '853', todo # Macao, China
country '854', todo # Spare code
View
4 spec/lib/phony/countries_spec.rb
@@ -138,6 +138,10 @@ def self.it_splits number, expected
it_splits '3025941234', ['30', '2594', '1234']
it_splits '3022631234', ['30', '2263', '1234']
end
+ describe 'Hong Kong' do
+ it_splits '85212341234', ['852', false, '1234', '1234'] #
+ end
+
describe 'Hungary' do
it_splits'3612345678', ['36', '1', '234', '5678']
it_splits'3622123456', ['36', '22', '123', '456']

0 comments on commit 1e2134a

Please sign in to comment.
Something went wrong with that request. Please try again.