Project

General

Profile

Feature #14550

Support keyword arguments with Date#step

Added by ksss (Yuki Kurihara) about 1 year ago. Updated about 1 year ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:85798]

Description

How about supporting keyword arguments with Date#step like Numeric#step?

from = Date.new(2018, 1, 1)
to = Date.new(2018, 2, 1)
from.step(to: to, by: 3).to_a

I expected that this is already supported.
But not.


Files

date-step.patch (2.8 KB) date-step.patch ksss (Yuki Kurihara), 02/24/2018 02:34 PM
date-step-2.patch (3.46 KB) date-step-2.patch ksss (Yuki Kurihara), 02/25/2018 08:35 AM

History

Updated by shevegen (Robert A. Heiler) about 1 year ago

Seems ok.

For others, here is a quick link to the documentation for Date
in current ruby 2.5.0:

http://ruby-doc.org/stdlib-2.5.0/libdoc/date/rdoc/Date.html#method-i-step

Updated by ksss (Yuki Kurihara) about 1 year ago

Thank you for reviewing.
I updated the documentation for Date#step also. (date-step-2.patch)

Updated by avit (Andrew Vit) about 1 year ago

If adding keyword options, would it make sense to add the possibility to enumerate by >> for whole months instead of only succ days, or is that out of scope here?

Updated by duerst (Martin Dürst) about 1 year ago

avit (Andrew Vit) wrote:

If adding keyword options, would it make sense to add the possibility to enumerate by >> for whole months instead of only succ days, or is that out of scope here?

Please write a separate feature describing your proposal in more detail. You can link to this feature if you think it's related.

Also available in: Atom PDF