Class: Runt::EveryTE
- Inherits:
-
Object
- Object
- Runt::EveryTE
- Includes:
- TExpr
- Defined in:
- lib/runt/temporalexpression.rb
Overview
Using the precision from the supplied start argument and the its date value, matches every n number of time units thereafter.
Instance Method Summary collapse
- #include?(date) ⇒ Boolean
-
#initialize(start, n) ⇒ EveryTE
constructor
A new instance of EveryTE.
- #to_s ⇒ Object
Methods included from TExpr
#&, #-, #and, #dates, #minus, #or, #|
Constructor Details
#initialize(start, n) ⇒ EveryTE
Returns a new instance of EveryTE.
671 672 673 674 |
# File 'lib/runt/temporalexpression.rb', line 671 def initialize(start,n) @start=start @interval=n end |
Instance Method Details
#include?(date) ⇒ Boolean
676 677 678 679 680 681 682 683 684 685 |
# File 'lib/runt/temporalexpression.rb', line 676 def include?(date) i=DPrecision.to_p(@start,@start.date_precision) # Use the precision of the start date d=DPrecision.to_p(date,@start.date_precision) while i<=d return true if i.eql?(d) i=i+@interval end false end |
#to_s ⇒ Object
687 688 689 |
# File 'lib/runt/temporalexpression.rb', line 687 def to_s "every #{@interval} #{@start.date_precision.label.downcase}s starting #{Runt.format_date(@start)}" end |