Class: Representable::XML::TextBinding
- Defined in:
- lib/representable/bindings/xml_bindings.rb
Overview
Represents text content in a tag. # FIXME: is this tested???
Instance Attribute Summary
Attributes inherited from Binding
Instance Method Summary collapse
-
#update_xml(xml, value) ⇒ Object
Updates the text in the given xml block to the value provided.
Methods inherited from Binding
Constructor Details
This class inherits a constructor from Representable::XML::Binding
Instance Method Details
#update_xml(xml, value) ⇒ Object
Updates the text in the given xml block to the value provided.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/representable/bindings/xml_bindings.rb', line 66 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(name), v) end else add(xml.add_node(name), value) end end end |