Sha256: dd3f8472385c3a95af5a332531707280132b343066bd7ae1dc8dd36f5a02ae96
Contents?: true
Size: 860 Bytes
Versions: 29
Compression:
Stored size: 860 Bytes
Contents
module Eco module API module Common module People class DefaultParsers class MultiParser < People::BaseParser def process @parsers.define_attribute(:multiple) do |parser| parser.def_parser do |value| return value if value.is_a?(Array) value = value.split("|") if value&.include?("|") into_a(value) end.def_serializer do |value| into_a(value).join("|") end end end private def into_a(value) value = [] if value == nil value = [].push(value) unless value.is_a?(Array) value end end end end end end end
Version data entries
29 entries across 29 versions & 1 rubygems