Class: Labimotion::ExportElementVariations
- Inherits:
-
Object
- Object
- Labimotion::ExportElementVariations
- Defined in:
- lib/labimotion/libs/export_element_variations.rb
Overview
ExportElementVariations Writes a generic element's variations to an .xlsx workbook that ImportElementVariations can read back. See ImportElementVariations for the inverse.
Sheet Variations:
row 1 group header (Properties / Metadata / Segments)
row 2 sub-group header (layer or segment name)
row 3 leaf header (field label, with its unit token)
row 4 machine column keys (hidden)
row 5 unit token per column (hidden)
row 6+ one row per variation
Rows 1-3 mirror the banded header the React grid draws, merged the same way: a header with no level below it spans down to row 3. Rows 4 and 5 are what make the export re-importable; they are hidden so a user only ever sees the header and the data.
Constant Summary collapse
- SHEET_NAME =
'Variations'- INFO_SHEET_NAME =
'Info'- SCHEMA_VERSION =
2- HEADER_ROWS =
Labimotion::ElementVariationHeader::ROWS
- KEY_ROW =
HEADER_ROWS + 1
- UNIT_ROW =
HEADER_ROWS + 2
- MULTI_VALUE_SEPARATOR =
'; '- GROUP_HEADER_BG =
'C5D9F1'- SUB_GROUP_HEADER_BG =
'DCE6F1'- NUMERIC_FIELD_TYPES =
system-definedis the unit-bearing numeric field type. %w[integer number system-defined].freeze
- MULTI_VALUE_FIELD_TYPES =
%w[select-multi].freeze
Instance Attribute Summary collapse
-
#column_set ⇒ Object
readonly
Returns the value of attribute column_set.
-
#element ⇒ Object
readonly
Returns the value of attribute element.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#variation ⇒ Object
readonly
Returns the value of attribute variation.
Instance Method Summary collapse
- #filename ⇒ Object
-
#initialize(element, variation: nil, user: nil, segment_klasses: nil) ⇒ ExportElementVariations
constructor
A new instance of ExportElementVariations.
- #read ⇒ Object
- #to_stream ⇒ Object
Constructor Details
#initialize(element, variation: nil, user: nil, segment_klasses: nil) ⇒ ExportElementVariations
Returns a new instance of ExportElementVariations.
40 41 42 43 44 45 46 47 |
# File 'lib/labimotion/libs/export_element_variations.rb', line 40 def initialize(element, variation: nil, user: nil, segment_klasses: nil) @element = element @variation = variation || element.element_variation @user = user @column_set = Labimotion::ElementVariationColumnSet.new( element, @variation, segment_klasses: segment_klasses ) end |
Instance Attribute Details
#column_set ⇒ Object (readonly)
Returns the value of attribute column_set.
49 50 51 |
# File 'lib/labimotion/libs/export_element_variations.rb', line 49 def column_set @column_set end |
#element ⇒ Object (readonly)
Returns the value of attribute element.
49 50 51 |
# File 'lib/labimotion/libs/export_element_variations.rb', line 49 def element @element end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
49 50 51 |
# File 'lib/labimotion/libs/export_element_variations.rb', line 49 def user @user end |
#variation ⇒ Object (readonly)
Returns the value of attribute variation.
49 50 51 |
# File 'lib/labimotion/libs/export_element_variations.rb', line 49 def variation @variation end |
Instance Method Details
#filename ⇒ Object
59 60 61 |
# File 'lib/labimotion/libs/export_element_variations.rb', line 59 def filename exporter.filename end |
#read ⇒ Object
51 52 53 |
# File 'lib/labimotion/libs/export_element_variations.rb', line 51 def read exporter.read end |
#to_stream ⇒ Object
55 56 57 |
# File 'lib/labimotion/libs/export_element_variations.rb', line 55 def to_stream exporter.to_stream end |