class TaskJuggler::LogicalFlag

This class handles operands that represent flags. The operation evaluates to true if the property provided by the expression has the flag assigned.

Public Class Methods

new(opnd) click to toggle source
Calls superclass method TaskJuggler::LogicalOperation.new
# File lib/taskjuggler/LogicalOperation.rb, line 230
def initialize(opnd)
  super
end

Public Instance Methods

eval(expr) click to toggle source

Return true if the property has the flag assigned.

# File lib/taskjuggler/LogicalOperation.rb, line 235
def eval(expr)
  if expr.query.is_a?(Query)
    # This is used for Project or PTN related Queries
    expr.query.property['flags', 0].include?(@operand1)
  else
    # This is used for Journal objects.
    expr.query.flags.include?(@operand1)
  end
end
to_s(query) click to toggle source
# File lib/taskjuggler/LogicalOperation.rb, line 245
def to_s(query)
  if query
    if query.is_a?(Query)
      query.property['flags', 0].include?(@operand1) ? 'true' : 'false'
    else
      query.flags.include?(@operand1) ? 'true' : 'false'
    end
  else
    @operand1
  end
end