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

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

Instance Attribute Summary

Attributes inherited from Binding

#represented, #user_options

Instance Method Summary collapse

Methods inherited from Collection

#serialize_for

Methods inherited from Representable::XML::Binding

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

Methods inherited from Binding

#[], #array?, #as, build, #compile_fragment, #default_for, #evaluate_option, #get, #getter, #has_default?, #initialize, #name, #parse_filter, #read_fragment, #render_filter, #render_fragment, #representable?, #representer_module, #representer_module_for, #set, #setter, #skipable_empty_value?, #typed?, #uncompile_fragment, #write_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) ⇒ Object

DISCUSS: use AttributeBinding here?



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

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