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

#cached_representer, #getter, #name, #setter

Instance Method Summary collapse

Methods included from Binding::Collection

#skipable_empty_value?

Methods inherited from Representable::XML::Binding

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

Methods inherited from Binding

#[], build, #default_for, #initialize, #skipable_empty_value?

Methods included from Binding::Factories

#collect_for, #default_parse_fragment_functions, #default_parse_init_functions, #default_post_functions, #default_render_fragment_functions, #default_render_init_functions, #parse_functions, #pipeline_for, #render_functions

Methods included from Binding::EvaluateOption

#evaluate_option

Methods included from Binding::Deprecatable

#compile_fragment, #uncompile_fragment

Constructor Details

This class inherits a constructor from Representable::Binding

Instance Method Details

#deserialize_from(nodes) ⇒ Object



92
93
94
95
96
97
98
# File 'lib/representable/xml/binding.rb', line 92

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, as) ⇒ Object



87
88
89
90
# File 'lib/representable/xml/binding.rb', line 87

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