Class: TaskJuggler::XMLText
- Inherits:
-
XMLElement
- Object
- XMLElement
- TaskJuggler::XMLText
- Defined in:
- lib/taskjuggler/XMLElement.rb
Overview
This is a specialized XMLElement to represent a simple text.
Instance Method Summary collapse
-
#initialize(text) ⇒ XMLText
constructor
A new instance of XMLText.
- #to_s(indent) ⇒ Object
Methods inherited from XMLElement
Constructor Details
#initialize(text) ⇒ XMLText
Returns a new instance of XMLText.
160 161 162 163 164 |
# File 'lib/taskjuggler/XMLElement.rb', line 160 def initialize(text) super(nil, {}) raise 'Text may not be nil' unless text @text = text end |
Instance Method Details
#to_s(indent) ⇒ Object
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/taskjuggler/XMLElement.rb', line 166 def to_s(indent) out = '' @text.each_utf8_char do |c| case c when '<' out << '<' when '>' out << '>' when '&' out << '&' else out << c end end out end |