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.



190
191
192
193
# File 'lib/runt/temporalexpression.rb', line 190

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

Instance Attribute Details

#expr1Object (readonly)

Returns the value of attribute expr1.



188
189
190
# File 'lib/runt/temporalexpression.rb', line 188

def expr1
  @expr1
end

#expr2Object (readonly)

Returns the value of attribute expr2.



188
189
190
# File 'lib/runt/temporalexpression.rb', line 188

def expr2
  @expr2
end

Instance Method Details

#==(o) ⇒ Object



195
196
197
# File 'lib/runt/temporalexpression.rb', line 195

def ==(o)
  o.is_a?(Diff) ? expr1 == o.expr1 && expr2 == o.expr2 : super(o)
end

#include?(aDate) ⇒ Boolean

Returns:

  • (Boolean)


199
200
201
202
# File 'lib/runt/temporalexpression.rb', line 199

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

#to_sObject



204
205
206
# File 'lib/runt/temporalexpression.rb', line 204

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