Skip to content

Properly decode every value type (polymorphy, beginner) #876

Description

@niccokunzmann

At the moment, each value type is different.
We have a method Component.decoded() which puts an incomplete if/else dispatch into place to get the decoded value.

It would be easier if all value types had a property such as ical_value which would result in the object used.

Examples

This would e.g. be

  • .td for timedelta
  • .dt for date
  • str(self) for vText

Places to edit

Classes to add ical_value to:

Other places to touch when the list above is done:

  • Component.decoded() uses ical_value and nothing else (Polymorphy)
  • remove TODO in Component.decoded()
  • Document how Component.decoded() works, so that new value types are easy to implement.

Checklist for all ical_value

For each of the added functions:

  • add a type hint
  • add a doc string
  • add a test for all possible code paths inside of ical_value
    • create the object
    • if needed add parameters
    • return the value
  • check the docstring turns up in the documentation and looks nice

Note: Corrected: it should be ical_value for consistency with to_ical and from_ical.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions