lib/LogicalExpression.rb in taskjuggler-0.0.4 vs lib/LogicalExpression.rb in taskjuggler-0.0.5

- old
+ new

@@ -31,16 +31,10 @@ @sourceFileInfo = sourceFileInfo @query = nil end - # Switch the scopeProperty to property. We need this for the scopeProperty - # operating functions. The @scopeProperty is set to nil. - def flipProperties - @query.property, @query.scopeProperty = @query.scopeProperty, nil - end - # 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. def eval(query) @query = query @@ -49,15 +43,16 @@ res.class == String # In TJP syntax 'non 0' means false. return res != 0 end - # This function is only used for debugging. - def to_s # :nodoc: + # Dump the LogicalExpression as a String. If _query_ is provided, it will + # show the actual values, otherwise just the variable names. + def to_s(query = nil) if @sourceFileInfo.nil? - "#{@operation}" + "#{@operation.to_s(query)}" else - str = "#{@sourceFileInfo} #{@operation}" + str = "#{@sourceFileInfo} #{@operation.to_s(query)}" end end # This is an internal function. It's called by the LogicalOperation methods # in case something went wrong during an evaluation.