Added support for parsing VEVENT from iCal format#465
Open
iainbeeston wants to merge 1 commit intoice-cube-ruby:masterfrom
Open
Added support for parsing VEVENT from iCal format#465iainbeeston wants to merge 1 commit intoice-cube-ruby:masterfrom
iainbeeston wants to merge 1 commit intoice-cube-ruby:masterfrom
Conversation
Author
|
The build is failing because travis is trying to use bundler 2.0 with ruby < 2.3. #459 should fix that |
a5a11d7 to
318153e
Compare
pacso
reviewed
Oct 21, 2021
pacso
reviewed
Oct 21, 2021
pacso
reviewed
Oct 21, 2021
pacso
reviewed
Oct 21, 2021
pacso
reviewed
Oct 21, 2021
pacso
reviewed
Oct 21, 2021
pacso
reviewed
Oct 21, 2021
pacso
reviewed
Oct 21, 2021
pacso
reviewed
Oct 21, 2021
pacso
reviewed
Oct 21, 2021
pacso
reviewed
Oct 21, 2021
pacso
previously approved these changes
Oct 21, 2021
seejohnrun
reviewed
Oct 25, 2021
lib/ice_cube/parsers/ical_parser.rb
Outdated
|
|
||
| parser, attr, occurrences = *send(parser, property, value) | ||
|
|
||
| case attr |
Collaborator
There was a problem hiding this comment.
This makes sense to me but what do you think of passing data into the parse_line and parse_vevent_line methods so that we can remove this generic case statement. I think personally it reads a bit confusing to me
Collaborator
There was a problem hiding this comment.
That makes sense to me. Should remove an unnecessary additional case statement.
Collaborator
There was a problem hiding this comment.
@iainbeeston - are you happy to push an update to this PR?
Author
There was a problem hiding this comment.
Sorry for the long wait, I've refactored this now to get rid of the extra case statement. Please let me know what you think.
d4423a5 to
c991f99
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
BACKGROUND
I have an ical file I'd like to parse with ice cube. It has no recurring events, just a series of one off events. Those events are stored in the file as
VEVENTs, where each event is a block of lines all describing a single event, starting withBEGIN:VEVENTand ending withEND:VEVENT(more detail here).CURRENT BEHAVIOUR
Icecube can't parse these events. It sees the
DTSTARTandDTENDinside theVEVENT, but applies them to the schedule.EXPECTED BEHAVIOUR
I would have expected it to add each
VEVENTas it's own recurrence time in the new schedule.SOLUTION
I've refactored the ical parser such that it acts as a state machine. By default it works as it did before. However, if it sees a
BEGIN:VEVENTline it goes into an event parsing mode, where it parses subsequent lines as events. Once it sees anEND:VEVENTline, it goes back to the regular mode. When parsing events it adds a new recurrence time every time it sees aDTSTART.NOTES
DTSTARTlines within an event, it will add a new recurrence time for each of them. AVEVENTwith more than oneDTSTARTis invalid, so this shouldn't happen in practice.VEVENTs can have an end date (ie.DTEND) as well as a start date (DTSTART). I couldn't see a way of adding a duration to a recurrence time, so I've ignored the end dates for now.