jackc / jackc/tod

Making `Tod::TimeOfDay.parse` more flexible

Open
#70 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
447
Forks
56
PR merge metrics
No merged PRs in 30d

Description

Proposal
--------
Currently, the only separator permitted by the parser is a colon (`:`)

How do you feel about making the parser more flexible by allowing any non-digit character to be treated as a seperator?

Rationale
---------
I work in the rail transport sector and railway timetables can contain a whole variety of separators, each with their own meaning:

- `08.00` - Regular passenger train
- `08+00` - Empty coaching stock
- `08S00` - Stop for staff pick up / set down only
- `08RM00` - Train will make a reversing move. (Depart in the same direction it arrived)

I'm sure there are other areas, including user input via html forms, where greater flexibilty might be beneficial.

Allowing any separator will make parsing any data more flexible and simpler.

Problems
--------
The change could possibly break clients that rely on `Tod` parsability to validate data that must **only** use a colon as a seperator

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the Tod::TimeOfDay.parse entry point and inspect how separators are currently recognized, along with any existing parser tests. Define and test the accepted non-digit separators while checking the reported concern that changing validation could affect clients that require colons.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.