Class: Runt::Diff

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

Overview

TExpr that will be true only if the first of its two contained expressions is true and the second is false.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TExpr

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

Constructor Details

#initialize(expr1, expr2) ⇒ Diff

Returns a new instance of Diff.



176
177
178
179
# File 'lib/runt/temporalexpression.rb', line 176

def initialize(expr1, expr2)
  @expr1 = expr1
  @expr2 = expr2
end

Instance Attribute Details

#expr1Object (readonly)

Returns the value of attribute expr1.



174
175
176
# File 'lib/runt/temporalexpression.rb', line 174

def expr1
  @expr1
end

#expr2Object (readonly)

Returns the value of attribute expr2.



174
175
176
# File 'lib/runt/temporalexpression.rb', line 174

def expr2
  @expr2
end

Instance Method Details

#include?(aDate) ⇒ Boolean

Returns:

  • (Boolean)


181
182
183
184
# File 'lib/runt/temporalexpression.rb', line 181

def include?(aDate)
  return false unless (@expr1.include?(aDate) && !@expr2.include?(aDate))
  true
end

#to_sObject



186
187
188
# File 'lib/runt/temporalexpression.rb', line 186

def to_s
  @expr1.to_s + ' except for ' + @expr2.to_s
end