Parent

Methods

Class Index [+]

Quicksearch

TaskJuggler::LogicalExpression

A LogicalExpression is an object that describes tree of LogicalOperation objects and the context that it should be evaluated in.

Attributes

query[R]
sourceFileInfo[R]

Public Class Methods

new(op, sourceFileInfo = nil) click to toggle source

Create a new LogicalExpression object. op must be a LogicalOperation. sourceFileInfo is the file position where expression started. It may be nil if not available.

    # File lib/taskjuggler/LogicalExpression.rb, line 30
30:     def initialize(op, sourceFileInfo = nil)
31:       @operation = op
32:       @sourceFileInfo = sourceFileInfo
33: 
34:       @query = nil
35:     end

Public Instance Methods

eval(query) click to toggle source

This function triggers the evaluation of the expression. property is the PropertyTreeNode that should be used for the evaluation. scopeProperty is the PropertyTreeNode that describes the scope. It may be nil.

    # File lib/taskjuggler/LogicalExpression.rb, line 40
40:     def eval(query)
41:       @query = query
42:       res = @operation.eval(self)
43:       return res if res.is_a?(TrueClass) || res.is_a?(FalseClass) ||
44:                     res.is_a?(String)
45:       # In TJP syntax 'non 0' means false.
46:       return res != 0
47:     end
to_s(query = nil) click to toggle source

Dump the LogicalExpression as a String. If query is provided, it will show the actual values, otherwise just the variable names.

    # File lib/taskjuggler/LogicalExpression.rb, line 51
51:     def to_s(query = nil)
52:       if @sourceFileInfo.nil?
53:         "#{@operation.to_s(query)}"
54:       else
55:         "#{@sourceFileInfo} #{@operation.to_s(query)}"
56:       end
57:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.