Class: Runt::TExpr
- Inherits:
-
Object
show all
- Defined in:
- lib/runt/temporalexpression.rb
Overview
FKA: TemporalExpression
Base class for all TExpr classes that has proved itself usefull enough to avoid O’s Razor, but that may wind up as a module.
‘TExpr’ is short for ‘TemporalExpression’ and are inspired by the recurring event pattern
[http://martinfowler.com/apsupp/recurring.pdf] described by Martin Fowler. Essentially, they provide a pattern language for specifying recurring events using set expressions.
See also [tutorial_te.rdoc]
Instance Method Summary
collapse
Instance Method Details
#&(expr) ⇒ Object
60
61
62
|
# File 'lib/runt/temporalexpression.rb', line 60
def & (expr)
self.and(expr){|adjusted| adjusted }
end
|
#-(expr) ⇒ Object
64
65
66
|
# File 'lib/runt/temporalexpression.rb', line 64
def - (expr)
self.minus(expr){|adjusted| adjusted }
end
|
#and(arg) ⇒ Object
42
43
44
45
46
47
48
49
50
|
# File 'lib/runt/temporalexpression.rb', line 42
def and (arg)
if self.kind_of?(Intersect)
self.add(arg)
else
yield Intersect.new.add(self).add(arg)
end
end
|
#include?(date_expr) ⇒ Boolean
Returns true or false depending on whether this TExpr includes the supplied date expression.
29
|
# File 'lib/runt/temporalexpression.rb', line 29
def include?(date_expr); false end
|
#minus(arg) {|Diff.new(self,arg)| ... } ⇒ Object
52
53
54
|
# File 'lib/runt/temporalexpression.rb', line 52
def minus (arg)
yield Diff.new(self,arg)
end
|
#or(arg) ⇒ Object
32
33
34
35
36
37
38
39
40
|
# File 'lib/runt/temporalexpression.rb', line 32
def or (arg)
if self.kind_of?(Union)
self.add(arg)
else
yield Union.new.add(self).add(arg)
end
end
|
#to_s ⇒ Object
30
|
# File 'lib/runt/temporalexpression.rb', line 30
def to_s; "TExpr" end
|
#|(expr) ⇒ Object
56
57
58
|
# File 'lib/runt/temporalexpression.rb', line 56
def | (expr)
self.or(expr){|adjusted| adjusted }
end
|