Make 'er quack like an Icalendar Component! #23
Merged
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.
In the Icalendar gem there is a
Component
class that many other classes inherit from, includingCalendar
andEvent
. TheComponent
specifies a:parent
attribute that is available on all of its inheritors. This is useful throughout the usage of the Icalendar gem since you can pass around a single object and still have access to most of the object tree if you need it.Occurrence
does not follow that pattern, requiring that any app passing around occurrences (either as an individual or an object) must also accompany that occurrence with the associated event if it wants any context. I don't think it's necessary to go so far as to makeOccurrence
inherit fromComponent
, as I want to be wary of too much overhead on an otherwise very simple class / struct, but I thinkOccurrence
could at least implement the:parent
method since that information is readily available at the time theOccurrence
s are instantiated inSchedule
.This PR adds and populates the
:parent
method on theOccurrence
object with a very simplistic change and adds a an example to the specs to make sure that the field is populated.