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

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

Comments

Projects
None yet
2 participants

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>]"
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

Owner

floere commented Oct 25, 2012

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

@joost joost referenced this issue in joost/phony_rails Feb 1, 2013

Merged

Do not normalize an implausible phone #16

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 Feb 21, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment