class Runt::DayIntervalTE

Using day precision dates, matches every n number of days after a given base date. All date arguments are converted to DPrecision::DAY precision.

Contributed by Ira Burton

Attributes

base_date[R]
interval[R]

Public Class Methods

new(base_date,n) click to toggle source
# File lib/runt/temporalexpression.rb, line 804
def initialize(base_date,n)
  @base_date = DPrecision.to_p(base_date,DPrecision::DAY)
  @interval = n
end

Public Instance Methods

==(o) click to toggle source
Calls superclass method
# File lib/runt/temporalexpression.rb, line 809
def ==(o)
  o.is_a?(DayIntervalTE) ? base_date == o.base_date && interval == o.interval  : super(o)
end
include?(date) click to toggle source
# File lib/runt/temporalexpression.rb, line 813
def include?(date)
  return ((DPrecision.to_p(date,DPrecision::DAY) - @base_date).to_i % @interval == 0)   
end
to_s() click to toggle source
# File lib/runt/temporalexpression.rb, line 817
def to_s
  "every #{Runt.ordinalize(@interval)} day after #{Runt.format_date(@base_date)}"
end