require 'fiona7/attribute_writers/attribute_writer' require 'fiona7/attribute_writers/helpers/link_serializer' module Fiona7 module AttributeWriters class LinkAsLinklist < AttributeWriter def call(value, claimed_type=nil) value = value || {} if value.empty? self.obj.set(self.attr_name, []) else link = Helpers::LinkSerializer.new(self.obj, self.klass).call(value) self.obj.set(self.attr_name, [link]) end end end end end