Class: Representable::XML::HashBinding
- Inherits:
-
CollectionBinding
- Object
- Binding
- PropertyBinding
- CollectionBinding
- Representable::XML::HashBinding
- Defined in:
- lib/representable/bindings/xml_bindings.rb
Instance Attribute Summary
Attributes inherited from Binding
Instance Method Summary collapse
Methods inherited from CollectionBinding
Methods inherited from PropertyBinding
#deserialize_node, #initialize, #read, #serialize_for, #serialize_node, #write
Methods inherited from Binding
Methods included from Binding::Hooks
Constructor Details
This class inherits a constructor from Representable::XML::PropertyBinding
Instance Method Details
#deserialize_from(nodes) ⇒ Object
104 105 106 107 108 109 110 |
# File 'lib/representable/bindings/xml_bindings.rb', line 104 def deserialize_from(nodes) {}.tap do |hash| nodes.children.each do |node| hash[node.name] = deserialize_node(node) end end end |
#serialize_items(value, parent) ⇒ Object
97 98 99 100 101 102 |
# File 'lib/representable/bindings/xml_bindings.rb', line 97 def serialize_items(value, parent) value.collect do |k, v| node = Nokogiri::XML::Node.new(k, parent.document) serialize_node(node, v) end end |