forked from square/ruby-rrule
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes square#46. Fixes square#47. Prior to this commit the gem failed to validate the RRULE's syntax: * If a keyword was misspelled, it would *silently* be ignored * If a keyword appeared multiple times only the last occurance was used * If the mutually exclusive keywords COUNT and UNTIL were used together then no exception was raised ```ruby > rrule = RRule.parse('FREQ=DAILY;COUNT=3;COUNT=7;UNTIL=20200302;INTERVALLLLL=9') => #<RRule::Rule:0x000055db33885018 ... > rrule.instance_variable_get(:@options) => {:interval=>1, :wkst=>1, :freq=>"DAILY", :count=>7, :until=>2020-03-02 00:00:00 +0100, ... ``` Therefore we add a validating parser with comprehensive error messages: ```ruby > rrule = RRule.parse('FREQ=DAILY;COUNT=3;COUNT=7;UNTIL=20200302;INTERVALLLLL=9') Traceback (most recent call last): ... RRule::InvalidRRule (SyntaxError) * unknown keyword 'INTERVALLLLL' at position 42: 'FREQ=DAILY;COUNT=3;COUNT=7;UNTIL=20200302;INTERVALLLLL=9' ^^^^^^^^^^^^ * keyword 'COUNT' appeared more than once at positions 11 and 19: 'FREQ=DAILY;COUNT=3;COUNT=7;UNTIL=20200302;INTERVALLLLL=9' ^^^^^ ^^^^^ * keywords 'COUNT' and 'UNTIL' are mutually exclusive at positions 11, 19 and 27: 'FREQ=DAILY;COUNT=3;COUNT=7;UNTIL=20200302;INTERVALLLLL=9' ^^^^^ ^^^^^ ^^^^^ ```
- Loading branch information
Showing
9 changed files
with
1,478 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.