Class: Representable::XML::Binding::Collection

Inherits:
Representable::XML::Binding show all
Includes:
Binding::Collection
Defined in:
lib/representable/xml/binding.rb

Direct Known Subclasses

AttributeHash, Hash

Instance Attribute Summary

Attributes inherited from Binding

#array, #cached_representer, #getter, #has_default, #name, #representable, #represented, #setter, #skip_filters, #typed, #user_options

Instance Method Summary collapse

Methods inherited from Representable::XML::Binding

build_for, #deserialize_method, #read, #serialize_method, #serialize_node, #write

Methods inherited from Binding

#[], #as, build, #compile_fragment, #default_for, #evaluate_option, #get, #initialize, #parse_filter, #read_fragment, #render_filter, #render_fragment, #representer_module_for, #set, #skipable_empty_value?, #uncompile_fragment, #update!, #write_fragment

Methods included from Binding::Factories

#deserializer, #deserializer_class, #populator, #populator_class, #serializer, #serializer_class

Constructor Details

This class inherits a constructor from Representable::Binding

Instance Method Details

#deserialize_from(nodes) ⇒ Object



89
90
91
92
93
94
95
# File 'lib/representable/xml/binding.rb', line 89

def deserialize_from(nodes)
  content_nodes = nodes.collect do |item| # TODO: move this to Node?
    content_for(item)
  end

  content_nodes
end

#serialize_for(value, parent) ⇒ Object



84
85
86
87
# File 'lib/representable/xml/binding.rb', line 84

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