Skip to content

Forward options through do_parse and its parser wrappers - #128

Open
OskarEichler wants to merge 1 commit into
floraison:masterfrom
OskarEichler:codex/forward-options-in-do-parse
Open

Forward options through do_parse and its parser wrappers#128
OskarEichler wants to merge 1 commit into
floraison:masterfrom
OskarEichler:codex/forward-options-in-do-parse

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

do_parse accepts an options hash but drops it when calling its parsers. Forward it consistently and let the duration/at wrappers accept optional options. This fixes multi-cron output, deterministic cron randomization and Chronic's reference time. It covers the raising API missed by the earlier non-raising fix in #116.

Reproduction

Run after require 'fugit':

require 'chronic'
p Fugit.do_parse('every day at 16:15 and 18:30', multi: true).map(&:to_cron_s)
# ["15 16 * * *", "30 18 * * *"]
p Fugit.do_parse('next weekday', now: Time.utc(1999, 12, 3)).strftime('%Y-%m-%d')
# "1999-12-06", rather than a date relative to today

Verification

  • rbenv Ruby 4.0.6, TZ=UTC. Master baseline and this individual patch: 1,524 existing tests, 3,379 assertions, zero failures, one existing pending test.
  • 8 focused checks for this change, run outside the repository. The combined release-based branch passes 1,517 existing RSpec examples, zero failures, one pending, plus 998 focused checks.
  • Also checked the combined master changes with unmodified registry EtOrbi 1.4.1/Raabro 1.5.0: 1,524 tests/3,379 assertions, zero failures, one pending, and 997 focused checks. The extra blank-line check requires the independently fixed Raabro empty-input behavior; it is not claimed to pass on unmodified Raabro.
  • Individual/release checks used the same versions of EtOrbi/Raabro with their separately proposed fixes. Syntax and whitespace checks pass. Combined source has the same 18 pre-existing Lint warnings, with no new warnings. Release gem packaging checked.

Compatibility and limitations

Supplied options now take effect, so multi:true can return an array and multi: :fail can raise as documented. Existing calls without options remain supported; do_parse_at/do_parse_duration gain an optional second argument.

No dependency/version upgrades, test additions or test modifications are included. The task's no-new-tests constraint was followed; reproduction/check scripts stayed outside the repository. Other Ruby versions and platforms await upstream CI. No production execution was performed. Prepared with Codex assistance.

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

Successfully merging this pull request may close these issues.

1 participant