Class: Representable::JSON::HashBinding
Instance Attribute Summary
Attributes inherited from Binding
#definition
Instance Method Summary
collapse
Methods inherited from JSONBinding
#initialize, #read, #write
Methods inherited from Binding
#initialize
#deserialize, #serialize
Instance Method Details
#deserialize_from(fragment) ⇒ Object
67
68
69
|
# File 'lib/representable/bindings/json_bindings.rb', line 67
def deserialize_from(fragment)
fragment.each { |key, item_fragment| fragment[key] = deserialize(item_fragment) }
end
|
#serialize_for(value) ⇒ Object
60
61
62
63
64
65
|
# File 'lib/representable/bindings/json_bindings.rb', line 60
def serialize_for(value)
{}.tap do |hash|
value.each { |key, obj| hash[key] = serialize(obj) }
end
end
|