step(limit, step=1)
public
Step the current date forward step
days at a time (or backward, if step is negative) until we reach
limit (inclusive), yielding the resultant date at each step.
Show source
def step(limit, step=1)
if step.zero?
raise ArgumentError, "step can't be 0"
end
unless block_given?
return to_enum(:step, limit, step)
end
da = self
op = %(- <= >=)[step <=> 0]
while da.__send__(op, limit)
yield da
da += step
end
self
end