module GoldenFleece::Model::Normalization
Public Instance Methods
normalize_fleece()
click to toggle source
# File lib/golden_fleece/model/normalization.rb, line 6 def normalize_fleece self.class.fleece_context.schemas.each do |attribute, schema| persisted_json = read_attribute attribute computed_json = deep_stringify_keys schema.reduce({}) { |memo, (schema_name, schema)| memo[schema_name] = schema.value.compute(self) memo } if !persisted_json.nil? && persisted_json != computed_json write_attribute attribute, computed_json end end end