Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use specified country_code in phone number when normalizing #23

Closed
wants to merge 2 commits into from

Conversation

espen
Copy link
Contributor

@espen espen commented May 6, 2013

fixes issue #22

@espen
Copy link
Contributor Author

espen commented May 6, 2013

Was supposed to create a new pull request for the last commit but since it is so minor I'll just let it be unless it bothers you.

@joost
Copy link
Owner

joost commented May 6, 2013

I changed it a bit. You can now force a country_code using:

PhonyRails.normalize_number('+4790909090', :country_code => 'SE').should eql('464790909090')

Or specify a default_country_code and it would not overwrite a given country_code:

PhonyRails.normalize_number('+4790909090', :default_country_code => 'SE').should eql('4790909090') # SE = +46

@joost joost closed this May 6, 2013
@espen
Copy link
Contributor Author

espen commented May 6, 2013

Makes sense. Perhaps use default_country_code in String.phony_formatted?

Current result:
"+4790909090".phony_formatted(:normalize => "SE", :format => :international, :spaces => '')
=> "+464790909090"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants