Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Fix formatting issue so you don't need to gsub #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

locochris
Copy link
Contributor

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"

@benkitzelman
Copy link

+1 this :)

@rubemz
Copy link

rubemz commented Aug 8, 2013

👍

1 similar comment
@xescugc
Copy link

xescugc commented May 21, 2014

👍

wallymathieu added a commit to GlobalPhone/GlobalPhone that referenced this pull request Jul 8, 2014
@wallymathieu
Copy link

Thanks!

wallymathieu added a commit to Lundalogik/globalphone_fork that referenced this pull request Jul 8, 2014
@toxaq
Copy link

toxaq commented Oct 16, 2014

Awesome, thanks.

futuretap pushed a commit to futuretap/global_phone that referenced this pull request Jan 12, 2015
@nicolasblanco
Copy link

Really need this to be merged 👍 !

@eileencodes
Copy link
Collaborator

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

@toxaq
Copy link

toxaq commented Oct 4, 2015

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

@locochris
Copy link
Contributor Author

@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.

@eileencodes
Copy link
Collaborator

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.

eg. current behaviour
```
GlobalPhone.parse("1520123456", "IE").national_format
```

gsub workaround:
```
GlobalPhone.parse("1520123456", "IE").national_format.gsub(/\s+/, ' ')
```
@locochris locochris changed the title BUGFIX discard extra whitespace Fix formatting issue so you don't need to gsub Oct 5, 2015
@locochris
Copy link
Contributor Author

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.

@sesam
Copy link

sesam commented Dec 18, 2015

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants