Class: ROXML::XMLTextRef

Inherits:
XMLRef
  • Object
show all
Defined in:
lib/roxml/xml/references.rb

Overview

Interal class representing XML content text binding

In context:

<element attribute="XMLAttributeRef">
 XMLTextRef
</element>

Direct Known Subclasses

XMLHashRef, XMLObjectRef

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 text in the given xml block to the value provided.



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/roxml/xml/references.rb', line 187

def update_xml(xml, value)
  wrap(xml).tap do |xml|
    if content?
      add(xml, value)
    elsif name?
      xml.name = value
    elsif array?
      value.each do |v|
        add(XML.add_node(xml, name), v)
      end
    else
      add(XML.add_node(xml, name), value)
    end
  end
end