Created
September 13, 2013 09:20
-
-
Save ewalk153/6548423 to your computer and use it in GitHub Desktop.
Format and standardize parsing of phone numbers in our projects with this
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_phone(string) | |
(Phoner::Phone.parse(string) || Phoner::Phone.parse('+' + string) rescue 'failed') | |
end | |
def verify_phones | |
CSV.generate do |csv| | |
Trip.all.each do |t| | |
csv << [t.mobile, parse_phone(t.mobile)] | |
end | |
end | |
end | |
output = verify_phones; '' | |
File.open("./phones.csv", "w+").write(output) | |
# parse_phone '33 6.20.29.73.33' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment