global_phone icon indicating copy to clipboard operation
global_phone copied to clipboard

Fix formatting issue so you don't need to gsub

Open locochris opened this issue 12 years ago • 12 comments
trafficstars

eg. current behaviour

GlobalPhone.parse("1520123456", "IE").national_format
#=> "1520  123 456"

gsub workaround:

GlobalPhone.parse("1520123456", "IE").national_format.gsub(/\s+/, ' ')
#=> "1520 123 456"

locochris avatar Jul 29 '13 22:07 locochris

+1 this :)

benkitzelman avatar Jul 30 '13 02:07 benkitzelman

:+1:

rubemz avatar Aug 08 '13 14:08 rubemz

:+1:

xescugc avatar May 21 '14 08:05 xescugc

Thanks!

wallymathieu avatar Jul 08 '14 20:07 wallymathieu

Awesome, thanks.

toxaq avatar Oct 16 '14 10:10 toxaq

Really need this to be merged :+1: !

nicolasblanco avatar Mar 16 '15 01:03 nicolasblanco

Hi @locochris, thanks for the PR! :smile: Can you tell me what bug not discarding the whitespace is causing?

eileencodes avatar Oct 04 '15 16:10 eileencodes

@eileencodes there's an example in the test included in the PR or did you mean something else?

toxaq avatar Oct 04 '15 22:10 toxaq

@eileencodes as @toxaq mentioned - its a formatting issue and there's a failing test case in the PR. It saves us (and probably @nicolasblanco , @toxaq et al) from having to write .gsub(/\s+/, ' ') type code for no good reason whenever we want to display the national number.

locochris avatar Oct 04 '15 23:10 locochris

The test really isn't an example of how having whitespace would break since it existed prior to this PR. Can you update the commit message to explain that it fixes a formatting issue so you don't need to gsub? I read it as whitespace was causing broken behavior.

eileencodes avatar Oct 05 '15 12:10 eileencodes

no worries - how's it look now @eileencodes ? BTW its whitespace in the output not in the input (if there was any confusion there). ie. it was a poorly formatted assertion in the test.

locochris avatar Oct 05 '15 21:10 locochris

is sstephenson the most active fork? I'd use this gem if I can rely on getting clean output.

sesam avatar Dec 18 '15 19:12 sesam