Method: TimeMath::Sequence#initialize

Defined in:
lib/time_math/sequence.rb

#initialize(unit, range) ⇒ Sequence

Creates a sequence. Typically, it is easier to do it with Units::Base#sequence, like this:

TimeMath.day.sequence(from...to)

Parameters:

  • unit (Symbol)
  • range (Range)

    range of time-y values (Time, Date, DateTime); note that range with inclusive and exclusive and will produce different sequences.



66
67
68
69
70
# File 'lib/time_math/sequence.rb', line 66

def initialize(unit, range)
  @unit = Units.get(unit)
  @from, @to = process_range(range)
  @op = Op.new
end