Methods

Class/Module Index [+]

Quicksearch

TaskJuggler::LogicalAttribute

This class handles operands that are property attributes. They are addressed by attribute ID and scenario index. The expression provides the property reference.

Public Class Methods

new(attribute, scenario) click to toggle source
# File lib/taskjuggler/LogicalOperation.rb, line 184
def initialize(attribute, scenario)
  @scenario = scenario
  super
end

Public Instance Methods

eval(expr) click to toggle source

To evaluate a property attribute we use the Query mechanism to retrieve the value.

# File lib/taskjuggler/LogicalOperation.rb, line 191
def eval(expr)
  query = expr.query.dup
  query.scenarioIdx = @scenario.sequenceNo - 1
  query.attributeId = @operand1
  query.process
  # The logical expressions are mostly about comparing values. So we use
  # the sortableResult of the Query. This creates some challenges for load
  # values, as the user is not accustomed to the internal representation
  # of those.
  # Convert nil results into empty Strings if necessary
  query.result || ''
end
to_s(query) click to toggle source

Dumps the LogicalOperation as String. If query is nil, the variable names are shown, otherwise their values.

# File lib/taskjuggler/LogicalOperation.rb, line 206
def to_s(query)
  if query
    query = query.dup
    query.scenarioIdx = @scenario.sequenceNo - 1
    query.attributeId = @operand1
    query.process
    query.to_s
  else
    "#{@scenario.fullId}.#{@operand1}"
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.