square / ruby-rrule

RRULE expansion for Ruby
Apache License 2.0
171 stars 25 forks source link

Implement `RRule::Rule#is_finite?` #55

Closed bahriddin closed 7 months ago

bahriddin commented 7 months ago

I am using gem to create repeating calendar events on DB. For that I want to check how many events do I need to create so I am using sth like this:

rrule = RRule::Rule.new("RRULE:FREQ=DAILY;INTERVAL=1")
puts rrule.count

When rule doesn't have ending rule it is calculating count using Enumerable.count and it is quite slow to count events between now and max_date (year 9999).

For this reason I believe having an interface to check if it has end limit will be handy.

rmitchell-sq commented 7 months ago

LGTM, thank you!