Permalink
Browse files

+ Singapore, Thailand

  • Loading branch information...
1 parent 48a5d4f commit b698d4caf8ba910c7c4c46d191498642d1ba66ba @floere committed Aug 1, 2011
Showing with 16 additions and 3 deletions.
  1. +8 −2 lib/phony/countries.rb
  2. +1 −1 phony.gemspec
  3. +7 −0 spec/lib/phony/countries_spec.rb
View
10 lib/phony/countries.rb
@@ -171,8 +171,14 @@
#
country '64', fixed(1) >> split(3,4)
- country '65', todo # TODO Singapore (Republic of)
- country '66', todo # TODO Thailand
+ # Singapore (Republic of).
+ #
+ country '65', none >> split(4,4) # TODO Short Codes.
+
+ # Thailand.
+ #
+ country '66', one_of('2') >> split(3,4) | # Bangkok
+ fixed(2) >> split(3,3) # Rest
country '81', todo # TODO Japan
View
2 phony.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'phony'
- s.version = '1.4.3'
+ s.version = '1.4.4'
s.authors = ['Florian Hanke']
s.email = 'florian.hanke+phony@gmail.com'
s.homepage = 'http://github.com/floere/phony'
View
7 spec/lib/phony/countries_spec.rb
@@ -158,10 +158,17 @@
Phony.split('825112345678').should == ['82', '51', '1234', '5678'] # Busan
Phony.split('821027975588').should == ['82', '10', '2797', '5588'] # mobile
end
+ it 'handles thai numbers' do
+ Phony.split('6621231234').should == ['66', '2', '123', '1234'] # Bangkok
+ Phony.split('6636123123').should == ['66', '36', '123', '123'] # Lop Buri
+ end
it 'handles tunisian numbers' do
Phony.split('21611231234').should == ['216', '1', '123', '1234'] # Ariana
Phony.split('21621231234').should == ['216', '2', '123', '1234'] # Bizerte
end
+ it "handles singaporean numbers" do
+ Phony.split('6561231234').should == ['65', '6123', '1234'] # Fixed line
+ end
it "handles slovakian numbers" do
Phony.split('421912123456').should == ['421', '912', '123456'] # Mobile
Phony.split('421212345678').should == ['421', '2', '12345678'] # Bratislava

0 comments on commit b698d4c

Please sign in to comment.