Method: JsonRecord::JsonField#serialize

Defined in:
lib/json_record/json_field.rb

#serializeObject



17
18
19
20
21
22
23
24
25
# File 'lib/json_record/json_field.rb', line 17

def serialize
  if @attributes
    stripped_attributes = {}
    @attributes.each_pair{|k, v| stripped_attributes[k] = v unless v.blank?}
    json = stripped_attributes.to_json
    json = Zlib::Deflate.deflate(json) if json and @compressed
    @record[@name] = json
  end
end