Class: HstoreData::Serializer
- Inherits:
-
Struct
- Object
- Struct
- HstoreData::Serializer
- Defined in:
- lib/hstore_data/serializer.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data
2 3 4 |
# File 'lib/hstore_data/serializer.rb', line 2 def data @data end |
Instance Method Details
#deserialize ⇒ Object
7 8 9 |
# File 'lib/hstore_data/serializer.rb', line 7 def deserialize sanitize { |value| JSON.load(value) rescue value } end |
#serialize ⇒ Object
3 4 5 |
# File 'lib/hstore_data/serializer.rb', line 3 def serialize sanitize { |value| value.respond_to?(:to_json) ? value.to_json : value } end |