Fix invalid url raising error during Groupie.tokenize #44
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's the problem?
An invalid URL-like String would cause
Groupie.tokenize
to raiseURI::InvalidURIError
.How to reproduce it?
What's changed in the solution?
The input that resembles a URL but fails to parse is no longer treated like a real URL, but simply as text that's processed by the rest of the code.
Due to the added responsibility of handling this new concern (is the URL valid or not?) I've extracted a helper method that encapsulates the new behavior and condensed the old code (which improves readability to my eyes) to stay within the line count guidelines that Rubocop enforces by default.
Tokenizer#tokenize_urls!
(c48148e)The changelog now points to both PRs for this feature.