Skip to content

Commit

Permalink
+ Russia etc. and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
floere committed Jul 2, 2012
1 parent 20ed1fc commit 7ea65d5
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
16 changes: 8 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ GEM
specs:
diff-lcs (1.1.3)
rake (0.9.2.2)
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
rspec-mocks (~> 2.8.0)
rspec-core (2.8.0)
rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.8.0)
rspec (2.10.0)
rspec-core (~> 2.10.0)
rspec-expectations (~> 2.10.0)
rspec-mocks (~> 2.10.0)
rspec-core (2.10.1)
rspec-expectations (2.10.0)
diff-lcs (~> 1.1.3)
rspec-mocks (2.10.1)

PLATFORMS
ruby
Expand Down
2 changes: 1 addition & 1 deletion README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -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 Afghan, Algerian, Austrian, Australian, Belgian, Brazilian, Chilean, Chinese, Croatian, Cuban, Czech, Danish, Dutch, Egyptian, French, German, Ghanan, Greek, Hungarian, Italian, Irish, Lithuanian, Malaysian, Mexican, New Zealand, Norwegian, Peruvian, Polish, Romanian, Singapore, Slovakian, South African, South Korean, 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, Malaysian, Mexican, New Zealand, 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.
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.
Expand Down
4 changes: 4 additions & 0 deletions history.textile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
h2. Upcoming Version.

h2. Version 1.7.6

* hanke: Russia, Kazakhstan, Abhasia *and* South Osetia (thanks glebm)!

h2. Version 1.7.5

* hanke: Fix for issue #47. If a number contains a rest (CC + NDC + rest) size that is in the range of @1..2@, it is not considered plausible (ie. @plausible?@ will return @false@).
Expand Down
12 changes: 6 additions & 6 deletions lib/phony/countries/russia_kazakhstan_abhasia_south_osetia.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@

Phony.define do
country '7', one_of(ndcs_with_5_subscriber_digits) >> split(1, 2, 2) |
one_of(ndcs_with_6_subscriber_digits) >> split(2, 2, 2) |
one_of(ndcs_with_7_subscriber_digits) >> split(3, 2, 2) |
one_of(%w(800)) >> split(3, 2, 2) | # Russia free number
one_of(%w(840 940)) >> split(2, 2, 2) | # Abhasia
one_of(%w(929 995344 9971 99744 9976 997 )) >> split(2, 2, 2) | # South Osetia
match(/[67]\d{2}/) >> split(2, 2, 2) # Kazakhstan: (600..799)
one_of(ndcs_with_6_subscriber_digits) >> split(2, 2, 2) |
one_of(ndcs_with_7_subscriber_digits) >> split(3, 2, 2) |
one_of(%w(800)) >> split(3, 2, 2) | # Russia free number
one_of(%w(840 940)) >> split(2, 2, 2) | # Abhasia
one_of(%w(929 995344 9971 99744 9976 997)) >> split(2, 2, 2) | # South Osetia
match(/[67]\d{2}/) >> split(2, 2, 2) # Kazakhstan: (600..799)
end
2 changes: 1 addition & 1 deletion phony.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'phony'
s.version = '1.7.5'
s.version = '1.7.6'
s.authors = ['Florian Hanke']
s.email = '[email protected]'
s.homepage = 'http://github.com/floere/phony'
Expand Down
4 changes: 3 additions & 1 deletion spec/lib/phony/countries_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,11 @@
it 'handles russian numbers' do
Phony.split('78122345678').should == ['7', '812', '234', '56', '78']
Phony.split('74012771077').should == ['7', '4012', '77', '10', '77']
Phony.split('78402411212').should == ['7', '84024', '1', '12', '12']
Phony.split('7840121212').should == ['7', '840', '12', '12', '12']
end
it 'handles south korean numbers' do
Phony.split('82212345678').should == ['82', '2', '1234', '5678'] # Seoul
Phony.split('82212345678').should == ['82', '2', '1234', '5678'] # Seoul
Phony.split('825112345678').should == ['82', '51', '1234', '5678'] # Busan
Phony.split('821027975588').should == ['82', '10', '2797', '5588'] # mobile
Phony.split('821087971234').should == ['82', '10', '8797', '1234'] # mobile
Expand Down

0 comments on commit 7ea65d5

Please sign in to comment.