Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Normalizing a country code on its own gives Phony::NationalCode inspect output #44
How to reproduce issue
"1[#<Phony::NationalCode:0x982504c @national_splitter=#<Phony::NationalSplitters::Fixed:0x9825254 @SiZe=3, @zero=nil>, @local_splitter=#<Phony::LocalSplitters::Fixed:0xa7e6be8 @Format=[3, 14]>, @normalize=true>]"
Note, I'm using version 1.7.2.
Thanks for a great gem,
Thanks for the sensible issue entry.
In a nutshell: Phony only handles international numbers that conform to E164 or are normalizable to it. For example: https://github.com/floere/phony/blob/master/spec/lib/phony_spec.rb#L190-194.
Currently, I am debating whether to raise a useful error, but since I'd like Phony to be only for handling E164 numbers, I'm unsure.
One idea is to check the number first, something like:
Phony.normalize! number if Phony.plausible? number
Does that help?
Thanks for the quick feedback floere.
I did not give the best example, which also illustrates the problem with plausible?().
Giving the output...
Basically I think that plausible?() is returning true but then normalize!() chokes on the processing.
Great to hear! Due to the nature of its domain, Phony is a work in progress and I am very glad to get such good feedback to improve it. I am the last man to say it's finished or perfect, so your help is much appreciated.
Contributors: My pleasure – if you wish to be listed in the "Github contributors", just send your next bug report as a failing test in the tests. (Although I hope that there are no further bugs)
Thanks! I really love languages, Gaeilge is in my top 10 :)
Oops. Didn't see this message you left 2 months ago. Thanks again for all the work on this and I'll shout if I hear of any updates to the Irish phone number system (hopefully there won't be any for a while!).
Gaeilge is a great ol language. Though Ruby is my fav these days :)