diff --git a/CHANGELOG.md b/CHANGELOG.md index 829ab0b..4d005f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ## fugit 1.10.1 not yet released +* Fix on Ruby 2.2.6 thanks to @aunghtain, gh-93 + ## fugit 1.10.0 released 2024-02-22 diff --git a/lib/fugit/cron.rb b/lib/fugit/cron.rb index 08ae890..42e2392 100644 --- a/lib/fugit/cron.rb +++ b/lib/fugit/cron.rb @@ -320,16 +320,23 @@ def previous_time(from=::EtOrbi::EoTime.now) # Used by Fugit::Cron#next and Fugit::Cron#prev # - class CronIterator include Enumerable + class CronIterator + include ::Enumerable + attr_reader :cron, :start, :current, :direction + def initialize(cron, direction, start) + @cron = cron @start = start @current = start.dup @direction = direction end + def each + loop do + yield(@current = @cron.send(@direction, @current)) end end