jackc / jackc/tod

Proposal: Implement Tod::TimeOfDay#upto / Tod::TimeOfDay#step

Open
#89 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 for new instance methods `upto` and/or `step`

These can be used as following cases

```ruby
Tod::TimeOfDay('10:00').upto(Tod::TimeOfDay('11::00')) do |tod|
puts tod
end
#=> 10:00::00, 10:00:01, 10:00:02, ...10:59:59, 11:00:00
```

```ruby
Tod::TimeOfDay('10:00').step(Tod::TimeOfDay('11::00'), 60) do |tod|
puts tod
end
#=> 10:00, 10:01, 10:02, ...10:59, 11:00
```

c.f.
https://rubydoc.info/stdlib/date/Date#step-instance_method
https://rubydoc.info/stdlib/date/Date#upto-instance_method

before working on implementation, I would like to hear a comment about this methods. Thank you!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the existing Tod::TimeOfDay API and the referenced Ruby Date#step and Date#upto documentation. Before coding, get agreement on the proposed method semantics, including the step argument and boundary behavior; done means those decisions are settled and the methods are implemented accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.