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

Examples in Readme don't work: undefined method 'next' for Fugit::Cron #94

Closed
pboling opened this issue Mar 7, 2024 · 1 comment
Closed
Assignees

Comments

@pboling
Copy link

pboling commented Mar 7, 2024

Issue description

next isn't defined on Fugit::Cron instance.

How to reproduce

The simplest piece of code that reproduces the issue, for example:

require 'fugit'
c = Fugit.parse_cron('0 12 * * mon#2')
c.next(Time.parse('2024-02-16 12:00:00'))

Error and error backtrace (if any)

(irb):19:in `<main>': undefined method `next' for #<Fugit::Cron:0x0000000113b59078 @original="0 12 * * mon#2", @cron_s=nil, @day_and=nil, @seconds=[0], @minutes=[0], @hours=[12], @monthdays=nil, @months=nil, @weekdays=[[1, 2]], @zone=nil, @timezone=nil> (NoMethodError)

Expected behaviour

require 'fugit'
c = Fugit.parse_cron('0 12 * * mon#2')
c.next(Time.parse('2024-02-16 12:00:00'))
  .take(3)
  .map(&:to_s)
    # => [ '2024-03-11 12:00:00',
    #      '2024-04-08 12:00:00',
    #      '2024-05-13 12:00:00' ]

I was expecting to continue on and get the result demonstrated in the readme, but that gives the exact same error.

Context

❯ uname -a
Darwin mb-pboling.home 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:33:31 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T8112 arm64

❯ bundle exec ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]

❯ bundle exec ruby -e "p [ :env_tz, ENV['TZ'] ]"
[:env_tz, nil]

❯ bundle exec ruby -r et-orbi -e "EtOrbi._make_info"
(secs:1709826544.345191,utc~:"2024-03-07 15:49:04.34519100189208984",ltz~:"MST")
(etz:nil,tnz:"MST",tziv:"2.0.6",tzidv:nil,rv:"3.2.2",rp:"arm64-darwin22",win:false,rorv:nil,astz:nil,eov:"1.2.7",eotnz:#<TZInfo::TimezoneProxy: America/Boise>,eotnfz:"-0700",eotlzn:"America/Boise",eotnfZ:"MST",debian:nil,centos:nil,osx:"zoneinfo/America/Denver")

❯ bundle exec ruby -r fugit -e "p [ :fugit, Fugit::VERSION ]"
[:fugit, "1.9.0"]

❯ bundle exec ruby -e "p [ :now, Time.now, :zone, Time.now.zone ]"
[:now, 2024-03-07 08:49:27.574976 -0700, :zone, "MST"]
@jmettraux jmettraux self-assigned this Mar 7, 2024
@jmettraux
Copy link
Member

Thanks!

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

No branches or pull requests

2 participants