global_phone
global_phone copied to clipboard
Fix formatting issue so you don't need to gsub
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"
+1 this :)
:+1:
:+1:
Thanks!
Awesome, thanks.
Really need this to be merged :+1: !
Hi @locochris, thanks for the PR! :smile: Can you tell me what bug not discarding the whitespace is causing?
@eileencodes there's an example in the test included in the PR or did you mean something else?
@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.
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.
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.
is sstephenson the most active fork? I'd use this gem if I can rely on getting clean output.