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

Phony.normalize('020') returns 'weird' string #51

Closed
joost opened this issue Jul 10, 2012 · 3 comments
Closed

Phony.normalize('020') returns 'weird' string #51

joost opened this issue Jul 10, 2012 · 3 comments

Comments

@joost
Copy link

joost commented Jul 10, 2012

Phony.normalize('020')
 => "20[#<Phony::NationalCode:0x007f92abd88c28 @national_splitter=#<Phony::NationalSplitters::Variable:0x007f92abd88db8 @size=nil, @zero=\"0\", @mapped_ndc_min_length=3, @mapped_ndc_max_length=3, @ndcs={3=>[\"800\"]}>, @local_splitter=#<Phony::LocalSplitters::Fixed:0x007f92abd88c50 @format=[17]>, @normalize=true>, #<Phony::NationalCode:0x007f92abd889a8 @national_splitter=#<Phony::NationalSplitters::Variable:0x007f92abd88b10 @size=nil, @zero=\"0\", @mapped_ndc_min_length=1, @mapped_ndc_max_length=1, @ndcs={1=>[\"2\", \"3\"]}>, @local_splitter=#<Phony::LocalSplitters::Fixed:0x007f92ac2e7e58 @format=[18]>, @normalize=true>, #<Phony::NationalCode:0x007f92abd88890 @national_splitter=#<Phony::NationalSplitters::Fixed:0x007f92abcea960 @size=2, @zero=\"0\">, @local_splitter=#<Phony::LocalSplitters::Fixed:0x007f92ac2e7e58 @format=[18]>, @normalize=true>]"
@floere
Copy link
Owner

floere commented Jul 10, 2012

Hey Joost,

020 is not a plausible, normalizable E164 number. Use

ruby -e 'require "phony"; p Phony.plausible?("020") # => false'

to check.

I am probably going to rewrite plausible? into a strict number checking method, while normalizable? (not yet existing) checks for normalisability (less strict).
(I will tell you when I do so – so you can set the dependencies on phony_rails :) )

Cheers,
Florian

@floere
Copy link
Owner

floere commented Oct 25, 2012

Leave this on as a reminder to think about this soon.

@floere
Copy link
Owner

floere commented Feb 21, 2013

This has (finally) been fixed in Phony 1.9.0:

$ ruby -e 'require "phony"; p Phony.normalize("020")'
"20"

Cheers!

@floere floere closed this as completed Feb 21, 2013
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

No branches or pull requests

2 participants