Class: DataMapper::Is::Serialized::Filters::GeneralSerializeFilter

Inherits:
SerializeFilter
  • Object
show all
Defined in:
lib/dm-is-serialized/is/filters.rb

Overview

called when any filter found

Instance Attribute Summary

Attributes inherited from SerializeFilter

#name, #record

Instance Method Summary collapse

Methods inherited from SerializeFilter

#property, #relationship

Instance Method Details

#deserialize(data) ⇒ Object



58
59
60
61
# File 'lib/dm-is-serialized/is/filters.rb', line 58

def deserialize(data)
  # "" => nil
  data.empty? ? nil : data
end

#serialize(data) ⇒ Object



53
54
55
56
# File 'lib/dm-is-serialized/is/filters.rb', line 53

def serialize(data)
  raise "Data too long" if data.to_s.length > 20
  return data
end