Skip to content

Feature Request: Add a #has_ended? method #37

Description

@gogvale

Currently if one tries to call #next it only throws a StopIteration error.
It would be nice to know if the until field is in the past for a safe catch.

Example:

Running via Spring preloader in process 25488
Loading development environment (Rails 6.1.3.1)
irb(main):001:0> str = "FREQ=DAILY;UNTIL=20210818T121000Z;COUNT=30;INTERVAL=1;WKST=MO"
irb(main):002:0> rrule = RRule.parse str
irb(main):003:0> rrule
=> #<RRule::Rule:0x00007fe920a96788 @tz="UTC", @dtstart=Thu, 19 Aug 2021 17:10:39.000000000 UTC +00:00, @exdate=[], @options={:interval=>1, :wkst=>1, :freq=>"DAILY", :until=>2021-08-18 12:10:00 UTC, :count=>30, :timeset=>[{:hour=>17, :minute=>10, :second=>39}]}, @frequency_type=RRule::Daily, @max_year=9999, @max_date=Fri, 01 Jan 9999 00:00:00 +0000>
irb(main):004:0> rrule.next
Traceback (most recent call last):
        1: from (irb):4
StopIteration (iteration reached an end)
irb(main):005:0>

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions