Method: TimeMath::Sequence#each

Defined in:
lib/time_math/sequence.rb

#eachEnumerator<Time, or Date, or DateTime>

Enumerates time unit between from and to. They will have same granularity as from (e.g. if unit is day and from is 2016-05-01 13:30, each of return values will be next day at 13:30), unless sequence is not set to floor values.

Returns:

  • (Enumerator<Time, or Date, or DateTime>)


194
195
196
197
198
199
200
201
202
203
# File 'lib/time_math/sequence.rb', line 194

def each
  return to_enum(:each) unless block_given?

  iter = from
  while iter <= to
    yield(op.call(iter))

    iter = unit.advance(iter)
  end
end