Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Comparison #11

Open
rcdilorenzo opened this issue Jun 4, 2016 · 0 comments
Open

Add Comparison #11

rcdilorenzo opened this issue Jun 4, 2016 · 0 comments
Labels

Comments

@rcdilorenzo
Copy link
Owner

It would be helpful if using this library for models that need to be generated within some range to be able to compare the repeats. Below is an example of this sort of usage:

import Repeatex, only: [parse: 1, compare_interval: 2]

assert compare_interval(parse("every day"), parse("every other day")) == :lt
assert compare_interval(parse("every day"), parse("every day")) == :eq
assert compare_interval(parse("mon-sat every week"), parse("every day")) == :gt
assert compare_interval(parse("monday every week"), parse("mon-wed every week")) == :eq

This would need to be delegated off to each corresponding model type and added to the appropriate protocol. It might also require some sort of general conversion from the type to the number of days (or range?) for a interval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant