Class: Representable::XML::CollectionBinding

Inherits:
PropertyBinding show all
Defined in:
lib/representable/bindings/xml_bindings.rb

Direct Known Subclasses

AttributeHashBinding, HashBinding

Instance Attribute Summary

Attributes inherited from Binding

#represented, #user_options

Instance Method Summary collapse

Methods inherited from PropertyBinding

build_for, #deserialize_node, #initialize, #read, #serialize_node, #write

Methods inherited from Binding

build, #compile_fragment, #deserialize, #get, #initialize, #read_fragment, #read_fragment_for, #serialize, #set, #uncompile_fragment, #write_fragment, #write_fragment_for

Constructor Details

This class inherits a constructor from Representable::XML::PropertyBinding

Instance Method Details

#deserialize_from(nodes) ⇒ Object



100
101
102
103
104
# File 'lib/representable/bindings/xml_bindings.rb', line 100

def deserialize_from(nodes)
  nodes.collect do |item|
    deserialize_node(item)
  end
end

#serialize_for(value, parent) ⇒ Object



95
96
97
98
# File 'lib/representable/bindings/xml_bindings.rb', line 95

def serialize_for(value, parent)
  # return NodeSet so << works.
  set_for(parent, value.collect { |item| super(item, parent) })
end