Class: ROXML::XMLHashRef
- Inherits:
-
XMLTextRef
- Object
- XMLRef
- XMLTextRef
- ROXML::XMLHashRef
- Defined in:
- lib/roxml/xml/references.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from XMLRef
Instance Method Summary collapse
-
#initialize(opts, inst) ⇒ XMLHashRef
constructor
A new instance of XMLHashRef.
- #several? ⇒ Boolean
-
#update_xml(xml, value) ⇒ Object
Updates the composed XML object in the given XML block to the value provided.
Methods inherited from XMLRef
#blocks, #name, #to_xml, #value_in, #xpath_name
Constructor Details
#initialize(opts, inst) ⇒ XMLHashRef
Returns a new instance of XMLHashRef.
230 231 232 233 234 |
# File 'lib/roxml/xml/references.rb', line 230 def initialize(opts, inst) super(opts, inst) @key = opts.hash.key.to_ref(inst) @value = opts.hash.value.to_ref(inst) end |
Instance Method Details
#several? ⇒ Boolean
236 237 238 |
# File 'lib/roxml/xml/references.rb', line 236 def several? true end |
#update_xml(xml, value) ⇒ Object
Updates the composed XML object in the given XML block to the value provided.
242 243 244 245 246 247 248 249 250 |
# File 'lib/roxml/xml/references.rb', line 242 def update_xml(xml, value) wrap(xml).tap do |xml| value.each_pair do |k, v| node = XML.add_node(xml, hash.wrapper) @key.update_xml(node, k) @value.update_xml(node, v) end end end |