Class: ROXML::XMLAttributeRef

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

Overview

Interal class representing an XML attribute binding

In context:

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

Instance Attribute Summary

Attributes inherited from XMLRef

#opts

Instance Method Summary collapse

Methods inherited from XMLRef

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

Constructor Details

This class inherits a constructor from ROXML::XMLRef

Instance Method Details

#update_xml(xml, values) ⇒ Object

Updates the attribute in the given XML block to the value provided.



150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/roxml/xml/references.rb', line 150

def update_xml(xml, values)
  if array?
    values.each do |value|
      wrap(xml, :always_create => true).tap do |node|
        XML.set_attribute(node, name, value.to_s)
      end
    end
  else
    wrap(xml).tap do |xml|
      XML.set_attribute(xml, name, values.to_s)
    end
  end
end