Class: Representable::XML::CollectionBinding
- Inherits:
-
PropertyBinding
- Object
- Binding
- PropertyBinding
- Representable::XML::CollectionBinding
- Defined in:
- lib/representable/bindings/xml_bindings.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Binding
Instance Method Summary collapse
Methods inherited from PropertyBinding
build_for, #deserialize_method, #read, #serialize_method, #serialize_node, #write
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(nodes) ⇒ Object
91 92 93 94 95 96 97 98 |
# File 'lib/representable/bindings/xml_bindings.rb', line 91 def deserialize_from(nodes) content_nodes = nodes.collect do |item| # TODO: move this to Node? content_for(item) end # *Deserializer doesn't want anything format specific! CollectionDeserializer.new(self).deserialize(content_nodes) end |
#serialize_for(value, parent) ⇒ Object
86 87 88 89 |
# File 'lib/representable/bindings/xml_bindings.rb', line 86 def serialize_for(value, parent) # return NodeSet so << works. set_for(parent, value.collect { |item| super(item, parent) }) end |