class TaskJuggler::RTFQuery

This class is a specialized RichTextFunctionHandler that can be used to query the value of a project or property attribute.

Public Class Methods

new(project, sourceFileInfo = nil) click to toggle source
Calls superclass method
# File lib/taskjuggler/RichText/RTFQuery.rb, line 23
def initialize(project, sourceFileInfo = nil)
  @project = project
  super('query', sourceFileInfo)
  @blockMode = false
end

Public Instance Methods

to_html(args) click to toggle source

Return a XMLElement tree that represents the navigator in HTML code.

# File lib/taskjuggler/RichText/RTFQuery.rb, line 41
def to_html(args)
  return nil unless (query = prepareQuery(args))
  if query.ok
    if (rti = query.to_rti)
      rti.to_html
    elsif (str = query.to_s)
      XMLText.new(str)
    else
      nil
    end
  else
    error('query_error', query.errorMessage + recreateQuerySyntax(args))
    font = XMLElement.new('font', 'color' => '#FF0000')
    font << XMLText.new('Query Error: ' + query.errorMessage)
    font
  end
end
to_s(args) click to toggle source

Return the result of the query as String.

# File lib/taskjuggler/RichText/RTFQuery.rb, line 30
def to_s(args)
  return '' unless (query = prepareQuery(args))
  if query.ok
    query.to_s
  else
    error('query_error', query.errorMessage + recreateQuerySyntax(args))
    'Query Error: ' + query.errorMessage
  end
end
to_tagged(args) click to toggle source

Not supported for this function.

# File lib/taskjuggler/RichText/RTFQuery.rb, line 60
def to_tagged(args)
  nil
end