Skip to content

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

@asayamakk

Description

@asayamakk

Proposal for new instance methods upto and/or step

These can be used as following cases

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
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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions