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.



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

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(xml, v.to_xml(params))
      end
    elsif value.is_a?(ROXML)
      XML.add_child(xml, value.to_xml(params))
    else
      XML.add_node(xml, name).tap do |node|
        XML.set_content(node, value.to_xml)
      end
    end
  end
end