Class: DataMapper::Is::Serialized::Filters::BooleanSerializeFilter

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

Overview

serialize: true => 1, false => 0

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



25
26
27
# File 'lib/dm-is-serialized/is/filters.rb', line 25

def deserialize(data)
  data.to_i == 1
end

#serialize(data) ⇒ Object



21
22
23
# File 'lib/dm-is-serialized/is/filters.rb', line 21

def serialize(data)
  data ? 1 : 0
end