Permalink
Browse files

Modified "default" so it can be used alone.

I'm not sure the best way to work "default" into the DSL since it's
effectively stating that there is only a CC+NDC and no Local part.
The DSL expects both.
  • Loading branch information...
1 parent d0d9a83 commit 47d740903424df9cd6b35e2db005535a7accf88b @mrchucho mrchucho committed Jul 15, 2011
Showing with 7 additions and 2 deletions.
  1. +1 −1 lib/phony/countries.rb
  2. +1 −1 lib/phony/dsl.rb
  3. +5 −0 spec/lib/phony_spec.rb
View
2 lib/phony/countries.rb
@@ -496,7 +496,7 @@
country '970', fixed(2) >> split(3,2,2) # Reserved
country '971', fixed(2) >> split(3,2,2) # United Arab Emirates
- country '972', fixed(2) >> split(3,2,2) # Israel (State of)
+ country '972', default # Israel (State of)
country '973', fixed(2) >> split(3,2,2) # Bahrain (Kingdom of)
country '974', fixed(2) >> split(3,2,2) # Qatar (State of)
country '975', fixed(2) >> split(3,2,2) # Bhutan (Kingdom of)
View
2 lib/phony/dsl.rb
@@ -74,7 +74,7 @@ def match regex, options = {}
NationalSplitters::Regex.instance_for regex, options[:on_fail_take]
end
def default
- NationalSplitters::Default.instance_for
+ none >> NationalSplitters::Default.instance_for
end
# Local splitters.
View
5 spec/lib/phony_spec.rb
@@ -193,6 +193,11 @@
Phony.format('414436435').should == '+41 44 364 35'
end
end
+ context '"unsupported" countries' do
+ it 'handles normalizing, then formatting' do
+ Phony.format(Phony.normalize('+880-321 5560 5220')).should == '+880 32155605220'
+ end
+ end
end
context "speed" do

0 comments on commit 47d7409

Please sign in to comment.