Class: Representable::XML::AttributeHashBinding
- Inherits:
-
CollectionBinding
- Object
- Binding
- PropertyBinding
- CollectionBinding
- Representable::XML::AttributeHashBinding
- Defined in:
- lib/representable/bindings/xml_bindings.rb
Instance Attribute Summary
Attributes inherited from Binding
Instance Method Summary collapse
- #deserialize_from(node) ⇒ Object
-
#write(parent, value) ⇒ Object
DISCUSS: use AttributeBinding here?.
Methods inherited from CollectionBinding
Methods inherited from PropertyBinding
build_for, #deserialize_method, #read, #serialize_for, #serialize_method, #serialize_node
Methods included from Binding::Object
#create_object, #deserialize, #serialize
Methods inherited from Binding
#as, build, #compile_fragment, #get, #initialize, #read_fragment, #read_fragment_for, #representer_module_for, #set, #uncompile_fragment, #write_fragment, #write_fragment_for
Constructor Details
This class inherits a constructor from Representable::Binding
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Representable::Binding
Instance Method Details
#deserialize_from(node) ⇒ Object
133 134 135 136 137 138 139 |
# File 'lib/representable/bindings/xml_bindings.rb', line 133 def deserialize_from(node) {}.tap do |hash| node.each do |k,v| hash[k] = deserialize(v) end end end |
#write(parent, value) ⇒ Object
DISCUSS: use AttributeBinding here?
126 127 128 129 130 131 |
# File 'lib/representable/bindings/xml_bindings.rb', line 126 def write(parent, value) # DISCUSS: is it correct overriding #write here? value.collect do |k, v| parent[k] = serialize(v.to_s) end parent end |