Class: Representable::XML::Binding::AttributeHash

Inherits:
Collection show all
Defined in:
lib/representable/xml/binding.rb

Instance Attribute Summary

Attributes inherited from Binding

#cached_representer, #getter, #name, #setter

Instance Method Summary collapse

Methods inherited from Collection

#serialize_for

Methods included from Binding::Collection

#skipable_empty_value?

Methods inherited from Representable::XML::Binding

build_for, #deserialize_method, #read, #serialize_for, #serialize_method, #serialize_node

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(node) ⇒ Object

FIXME: this is not tested!



134
135
136
# File 'lib/representable/xml/binding.rb', line 134

def deserialize_from(node)
  HashDeserializer.new(self).deserialize(node)
end

#write(parent, value, as) ⇒ Object

DISCUSS: use AttributeBinding here?



126
127
128
129
130
131
# File 'lib/representable/xml/binding.rb', line 126

def write(parent, value, as)  # DISCUSS: is it correct overriding #write here?
  value.collect do |k, v|
    parent[k] = v.to_s
  end
  parent
end