Class: ROXML::XMLObjectRef

Inherits:
XMLTextRef show all
Defined in:
lib/roxml/xml/references.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from XMLRef

#opts

Instance Method Summary collapse

Methods inherited from XMLRef

#blocks, #initialize, #name, #to_xml, #value_in, #xpath_name

Constructor Details

This class inherits a constructor from ROXML::XMLRef

Instance Method Details

#update_xml(xml, value) ⇒ Object

Updates the composed XML object in the given XML block to the value provided.



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/roxml/xml/references.rb', line 287

def update_xml(xml, value)
  wrap(xml).tap do |xml|
    params = {:name => name, :namespace => opts.namespace}
    if array?
      value.each do |v|
        xml.add_child(v.to_xml(params))
      end
    elsif value.is_a?(ROXML)
      xml.add_child(value.to_xml(params))
    else
      node = XML::Node.create(name)
      node.content = value.to_xml
      xml.add_child(node)
    end
  end
end