# Copyright (c) 2020 Jerome Arbez-Gindre # frozen_string_literal: true require('csv') module DefMastership # format header for one document class CSVFormatterHeader def initialize(doc) @doc = doc end def fixed %w[Type Reference Value sha256] end def wrong_explicit_checksum @doc.wrong_explicit_checksum? ? ['Wrong explicit checksum'] : [] end def labels @doc.labels.empty? ? [] : %w[Labels] end def eref @doc.eref.map { |_, ref| ref[:prefix] } end def iref @doc.iref ? ['Internal links'] : [] end def attributes @doc.attributes.map { |_, value| value } end end end