Runt::TExpr

‘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]

Public Instance Methods

&(expr) click to toggle source
# File lib/runt/temporalexpression.rb, line 56
def & (expr)
  self.and(expr){|adjusted| adjusted }
end
-(expr) click to toggle source
# File lib/runt/temporalexpression.rb, line 60
def - (expr)
  self.minus(expr){|adjusted| adjusted }
end
and(arg) click to toggle source
# File lib/runt/temporalexpression.rb, line 38
def and (arg)

  if self.kind_of?(Intersect)
    self.add(arg)
  else
    yield Intersect.new.add(self).add(arg)
  end

end
dates(date_range, limit=0) click to toggle source

Contributed by Emmett Shear: Returns an Array of Date-like objects which occur within the supplied DateRange. Will stop calculating dates once a number of dates equal to the optional attribute limit are found. (A limit of zero will collect all matching dates in the date range.)

# File lib/runt/temporalexpression.rb, line 69
def dates(date_range, limit=0)
  result = []
  date_range.each do |date|
    result << date if self.include? date
    if limit > 0 and result.size == limit
      break
    end
  end
  result
end
include?(date_expr) click to toggle source

Returns true or false depending on whether this TExpr includes the supplied date expression.

# File lib/runt/temporalexpression.rb, line 24
def include?(date_expr); false end
minus(arg) click to toggle source
# File lib/runt/temporalexpression.rb, line 48
def minus (arg)
    yield Diff.new(self,arg)
end
or(arg) click to toggle source
# File lib/runt/temporalexpression.rb, line 28
def or (arg)

  if self.kind_of?(Union)
    self.add(arg)
  else
    yield Union.new.add(self).add(arg)
  end

end
to_s() click to toggle source
# File lib/runt/temporalexpression.rb, line 26
def to_s; "TExpr" end
|(expr) click to toggle source
# File lib/runt/temporalexpression.rb, line 52
def | (expr)
  self.or(expr){|adjusted| adjusted }
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.