Class: PGTrunk::Serializers::ArraySerializer
- Inherits:
-
ActiveRecord::Type::Value
- Object
- ActiveRecord::Type::Value
- PGTrunk::Serializers::ArraySerializer
- Defined in:
- lib/pg_trunk/core/serializers/array_serializer.rb
Overview
Cast the attribute value as an array, not caring about its content.
Instance Method Summary collapse
Instance Method Details
#cast(value) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/pg_trunk/core/serializers/array_serializer.rb', line 8 def cast(value) case value when ::NilClass then [] when ::Array then value else [value] end end |
#serialize(value) ⇒ Object
16 17 18 |
# File 'lib/pg_trunk/core/serializers/array_serializer.rb', line 16 def serialize(value) value end |