Class: Runt::BeforeTE

Inherits:
Object
  • Object
show all
Includes:
TExpr
Defined in:
lib/runt/temporalexpression.rb

Overview

Matches dates that occur before a given date.

Instance Method Summary collapse

Methods included from TExpr

#&, #-, #and, #dates, #minus, #or, #|

Constructor Details

#initialize(date, inclusive = false) ⇒ BeforeTE

Returns a new instance of BeforeTE.



760
761
762
763
# File 'lib/runt/temporalexpression.rb', line 760

def initialize(date, inclusive=false)
  @date = date
  @inclusive = inclusive
end

Instance Method Details

#include?(date) ⇒ Boolean

Returns:

  • (Boolean)


765
766
767
# File 'lib/runt/temporalexpression.rb', line 765

def include?(date)
  return (date < @date) || (@inclusive && @date == date)
end

#to_sObject



769
770
771
# File 'lib/runt/temporalexpression.rb', line 769

def to_s
  "before #{Runt.format_date(@date)}"
end