Class: TaskJuggler::XMLBlob

Inherits:
XMLElement show all
Defined in:
lib/taskjuggler/XMLElement.rb

Overview

This is a specialized XMLElement to represent XML blobs. The content is not interpreted and must be valid XML in the content it is added.

Instance Method Summary collapse

Methods inherited from XMLElement

#<<, #[], #[]=

Constructor Details

#initialize(blob = '') ⇒ XMLBlob

Returns a new instance of XMLBlob.

Raises:

  • (ArgumentError)


227
228
229
230
231
# File 'lib/taskjuggler/XMLElement.rb', line 227

def initialize(blob = '')
  super(nil, {})
  raise ArgumentError, "blob may not be nil" if blob.nil?
  @blob = blob
end

Instance Method Details

#to_s(indent) ⇒ Object



233
234
235
236
237
238
239
# File 'lib/taskjuggler/XMLElement.rb', line 233

def to_s(indent)
  out = ''
  @blob.each_utf8_char do |c|
    out += (c == "\n" ? "\n" + ' ' * indent : c)
  end
  out
end