# Copyright (c) 2020 Jerome Arbez-Gindre # frozen_string_literal: true require('csv') module DefMastership # format lines per definition class CSVFormatterBody def initialize(doc) @doc = doc end def fixed_body(definition) [definition.type, definition.reference, definition.value] end def labels_body(definition) @doc.labels.empty? ? [] : [definition.labels.to_a.join("\n")] end def eref_body(definition) @doc.eref.map { |key, _| definition.eref[key].join("\n") } end def iref_body(definition) @doc.iref ? [definition.iref.join("\n")] : [] end def attributes_body(definition) @doc.attributes.map do |key, _| definition.attributes[key] end end end end