Class: Defmastership::Export::HeaderFormatter
- Inherits:
-
Object
- Object
- Defmastership::Export::HeaderFormatter
- Defined in:
- lib/defmastership/export/header_formatter.rb
Overview
format CSV header (first line) for one document
Instance Method Summary collapse
-
#attributes ⇒ Array<String>
Optional attributes columns captions.
-
#eref ⇒ Array<String>
Optional external refs columns captions.
-
#explicit_version ⇒ Array<String>
Optional version column captions.
-
#initialize(doc) ⇒ HeaderFormatter
constructor
A new instance of HeaderFormatter.
-
#iref ⇒ Array<String>
Optional internal refs column caption.
-
#labels ⇒ Array<String>
Optional labels columns captions.
-
#wrong_explicit_checksum ⇒ Array<String>
Optional wrong_explicit_checksum column caption.
Constructor Details
#initialize(doc) ⇒ HeaderFormatter
Returns a new instance of HeaderFormatter.
9 10 11 |
# File 'lib/defmastership/export/header_formatter.rb', line 9 def initialize(doc) @doc = doc end |
Instance Method Details
#attributes ⇒ Array<String>
Returns Optional attributes columns captions.
45 46 47 |
# File 'lib/defmastership/export/header_formatter.rb', line 45 def attributes @doc.attributes.map { |_, value| value } end |
#eref ⇒ Array<String>
Returns Optional external refs columns captions.
35 36 37 |
# File 'lib/defmastership/export/header_formatter.rb', line 35 def eref @doc.eref.map { |_, ref| ref.fetch(:prefix) } end |
#explicit_version ⇒ Array<String>
Returns Optional version column captions.
25 26 27 |
# File 'lib/defmastership/export/header_formatter.rb', line 25 def explicit_version @doc.explicit_version? ? ['Version'] : [] end |
#iref ⇒ Array<String>
Returns Optional internal refs column caption.
40 41 42 |
# File 'lib/defmastership/export/header_formatter.rb', line 40 def iref @doc.iref ? ['Internal links'] : [] end |
#labels ⇒ Array<String>
Returns Optional labels columns captions.
30 31 32 |
# File 'lib/defmastership/export/header_formatter.rb', line 30 def labels @doc.labels.empty? ? [] : %w[Labels] end |
#wrong_explicit_checksum ⇒ Array<String>
Returns Optional wrong_explicit_checksum column caption.
20 21 22 |
# File 'lib/defmastership/export/header_formatter.rb', line 20 def wrong_explicit_checksum @doc.wrong_explicit_checksum? ? ['Wrong explicit checksum'] : [] end |