Class: Representable::Hash::CollectionBinding

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

Instance Attribute Summary

Attributes inherited from Binding

#represented, #user_options

Instance Method Summary collapse

Methods inherited from PropertyBinding

build_for, #deserialize_from, #deserialize_method, #read, #serialize_method, #write

Methods included from Binding::Object

#create_object

Methods inherited from Binding

#as, build, #compile_fragment, #get, #initialize, #read_fragment, #read_fragment_for, #representer_module_for, #set, #uncompile_fragment, #write_fragment, #write_fragment_for

Constructor Details

This class inherits a constructor from Representable::Binding

Instance Method Details

#deserialize(fragment) ⇒ Object



43
44
45
# File 'lib/representable/bindings/hash_bindings.rb', line 43

def deserialize(fragment)
  CollectionDeserializer.new(self).deserialize(fragment)
end

#serialize(value) ⇒ Object



39
40
41
# File 'lib/representable/bindings/hash_bindings.rb', line 39

def serialize(value)
  value.collect { |item| super(item) } # TODO: i don't want Array but Forms here - what now?
end