Class: ImpExp::Serializers::ArrayLike
- Inherits:
-
Object
- Object
- ImpExp::Serializers::ArrayLike
- Defined in:
- app/services/imp_exp/serializers/array_like.rb
Constant Summary collapse
- SEPARATOR =
"|"
Instance Method Summary collapse
- #dump(record, attribute_name) ⇒ Object
-
#load(data, model: nil, record: nil, scoping_parent: nil) ⇒ Object
rubocop: disable Lint/UnusedMethodArgument.
Instance Method Details
#dump(record, attribute_name) ⇒ Object
8 9 10 |
# File 'app/services/imp_exp/serializers/array_like.rb', line 8 def dump(record, attribute_name) record.send(attribute_name)&.join(SEPARATOR) end |
#load(data, model: nil, record: nil, scoping_parent: nil) ⇒ Object
rubocop: disable Lint/UnusedMethodArgument
13 14 15 16 17 |
# File 'app/services/imp_exp/serializers/array_like.rb', line 13 def load(data, model: nil, record: nil, scoping_parent: nil) return [] if data.blank? data.to_s.split(SEPARATOR).map(&:strip) end |