class Runt::EveryTE

Using the precision from the supplied start argument and the its date value, matches every n number of time units thereafter.

Attributes

interval[R]
precision[R]
start[R]

Public Class Methods

new(start,n,precision=nil) click to toggle source
# File lib/runt/temporalexpression.rb, line 767
def initialize(start,n,precision=nil)
  @start=start
  @interval=n
  # Use the precision of the start date by default
  @precision=precision || @start.date_precision
end

Public Instance Methods

==(o) click to toggle source
Calls superclass method
# File lib/runt/temporalexpression.rb, line 774
def ==(o)
  o.is_a?(EveryTE) ? start == o.start && precision == o.precision && interval == o.interval  : super(o)
end
include?(date) click to toggle source
# File lib/runt/temporalexpression.rb, line 778
def include?(date)
  i=DPrecision.to_p(@start,@precision)
  d=DPrecision.to_p(date,@precision)
  while i<=d
    return true if i.eql?(d)
    i=i+@interval      
  end
  false
end
to_s() click to toggle source
# File lib/runt/temporalexpression.rb, line 788
def to_s
  "every #{@interval} #{@precision.label.downcase}s starting #{Runt.format_date(@start)}"
end