Class TaskJuggler::XMLText
In: lib/taskjuggler/XMLElement.rb
Parent: XMLElement

This is a specialized XMLElement to represent a simple text.

Methods

new   to_s  

Public Class methods

[Source]

# File lib/taskjuggler/XMLElement.rb, line 160
    def initialize(text)
      super(nil, {})
      raise 'Text may not be nil' unless text
      @text = text
    end

Public Instance methods

[Source]

# File lib/taskjuggler/XMLElement.rb, line 166
    def to_s(indent)
      out = ''
      @text.each_utf8_char do |c|
        case c
        when '<'
          out << '&lt;'
        when '>'
          out << '&gt;'
        when '&'
          out << '&amp;'
        else
          out << c
        end
      end

      out
    end

[Validate]