Class: Representable::Hash::HashBinding
- Inherits:
-
PropertyBinding
- Object
- Binding
- PropertyBinding
- Representable::Hash::HashBinding
- Defined in:
- lib/representable/bindings/hash_bindings.rb
Instance Attribute Summary
Attributes inherited from Binding
Instance Method Summary collapse
Methods inherited from PropertyBinding
build_for, #deserialize_from, #deserialize_method, #read, #serialize_method, #write
Methods included from Binding::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
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Representable::Binding
Instance Method Details
#deserialize(fragment) ⇒ Object
57 58 59 60 61 |
# File 'lib/representable/bindings/hash_bindings.rb', line 57 def deserialize(fragment) {}.tap do |hsh| fragment.each { |key, item_fragment| hsh[key] = super(item_fragment) } end end |
#serialize(value) ⇒ Object
50 51 52 53 54 55 |
# File 'lib/representable/bindings/hash_bindings.rb', line 50 def serialize(value) # requires value to respond to #each with two block parameters. {}.tap do |hsh| value.each { |key, obj| hsh[key] = super(obj) } end end |