Class: Runt::Diff
- Inherits:
-
Object
- Object
- Runt::Diff
- 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
-
#expr1 ⇒ Object
readonly
Returns the value of attribute expr1.
-
#expr2 ⇒ Object
readonly
Returns the value of attribute expr2.
Instance Method Summary collapse
- #==(o) ⇒ Object
- #include?(aDate) ⇒ Boolean
-
#initialize(expr1, expr2) ⇒ Diff
constructor
A new instance of Diff.
- #to_s ⇒ Object
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
#expr1 ⇒ Object (readonly)
Returns the value of attribute expr1.
188 189 190 |
# File 'lib/runt/temporalexpression.rb', line 188 def expr1 @expr1 end |
#expr2 ⇒ Object (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
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_s ⇒ Object
204 205 206 |
# File 'lib/runt/temporalexpression.rb', line 204 def to_s @expr1.to_s + ' except for ' + @expr2.to_s end |