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.
Hi, I've noticed that VCardigan behaves a bit odd if I parse with it a file that contains multiple vCards.
I'd expect it to obey the begin and end lines of each card, but it doesn't and it ends up combining all the cards in the file into one large card with all the fields of all cards.
For instance, the following file:
if given to
.parse
would product a single vCard that combines John and Jane Doe.In this PR I've added two things:
.parse_all!
method which returns an enumerator which in term yields all cards one-by-one as it parses them.parse!
method which is the same as.parse
but strict in the sense that it raises an error if it encounters something unexpected while parsingCalling
.parse_all!
on the file from before would product 2 vCards:While calling
.parse!
on an invalid vCard produces an error, where before this would produce a vCard:The old behavior of the parse method was kept in case someone depends on it.
There are cases when that behavior is useful.
All new parser errors inherit from the old
EncodingError
for backwards compatibility.In the process I've also upgraded RSpec to version 3 so that it works with newer Ruby versions.