Sha256: 8b0c300347e6a1c849486e4e6822e545c732ea6a07d55d113845d04c9eb40535
Contents?: true
Size: 707 Bytes
Versions: 1
Compression:
Stored size: 707 Bytes
Contents
module GoldenFleece module Model module Normalization include Utility def normalize_fleece self.class.fleece_context.schemas.each do |attribute, schema| persisted_json = read_attribute attribute schema.each do |schema_name, schema| schema_name = schema_name.to_s computed_json = { schema_name => schema.value.compute(self) } deep_stringify_keys computed_json if computed_json.is_a? Hash if !persisted_json[schema_name].nil? && persisted_json[schema_name] != computed_json[schema_name] write_attribute attribute, computed_json end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
golden_fleece-0.1.0 | lib/golden_fleece/model/normalization.rb |