Class: Runt::AfterTE

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

Overview

Matches dates that occur after a given date.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TExpr

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

Constructor Details

#initialize(date, inclusive = false) ⇒ AfterTE

Returns a new instance of AfterTE.



985
986
987
988
# File 'lib/runt/temporalexpression.rb', line 985

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

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



983
984
985
# File 'lib/runt/temporalexpression.rb', line 983

def date
  @date
end

#inclusiveObject (readonly)

Returns the value of attribute inclusive.



983
984
985
# File 'lib/runt/temporalexpression.rb', line 983

def inclusive
  @inclusive
end

Instance Method Details

#==(o) ⇒ Object



990
991
992
# File 'lib/runt/temporalexpression.rb', line 990

def ==(o)
  o.is_a?(AfterTE) ? date == o.date && inclusive == o.inclusive  : super(o)
end

#include?(date) ⇒ Boolean

Returns:

  • (Boolean)


995
996
997
# File 'lib/runt/temporalexpression.rb', line 995

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

#to_sObject



999
1000
1001
# File 'lib/runt/temporalexpression.rb', line 999

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