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.



135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/roxml/xml/references.rb', line 135

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