Class: TaskJuggler::RTFQuery
- Inherits:
-
RTFWithQuerySupport
- Object
- RichTextFunctionHandler
- RTFWithQuerySupport
- TaskJuggler::RTFQuery
- Defined in:
- lib/taskjuggler/RichText/RTFQuery.rb
Overview
This class is a specialized RichTextFunctionHandler that can be used to query the value of a project or property attribute.
Instance Attribute Summary
Attributes inherited from RichTextFunctionHandler
Instance Method Summary collapse
-
#initialize(project, sourceFileInfo = nil) ⇒ RTFQuery
constructor
A new instance of RTFQuery.
-
#to_html(args) ⇒ Object
Return a XMLElement tree that represents the navigator in HTML code.
-
#to_s(args) ⇒ Object
Return the result of the query as String.
-
#to_tagged(args) ⇒ Object
Not supported for this function.
Methods inherited from RTFWithQuerySupport
Methods included from MessageHandler
#critical, #debug, #error, #fatal, #info, #warning
Constructor Details
#initialize(project, sourceFileInfo = nil) ⇒ RTFQuery
Returns a new instance of RTFQuery.
24 25 26 27 28 |
# File 'lib/taskjuggler/RichText/RTFQuery.rb', line 24 def initialize(project, sourceFileInfo = nil) @project = project super('query', sourceFileInfo) @blockMode = false end |
Instance Method Details
#to_html(args) ⇒ Object
Return a XMLElement tree that represents the navigator in HTML code.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/taskjuggler/RichText/RTFQuery.rb', line 42 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) ⇒ Object
Return the result of the query as String.
31 32 33 34 35 36 37 38 39 |
# File 'lib/taskjuggler/RichText/RTFQuery.rb', line 31 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) ⇒ Object
Not supported for this function.
61 62 63 |
# File 'lib/taskjuggler/RichText/RTFQuery.rb', line 61 def to_tagged(args) nil end |