Class: Labimotion::ElementVariationHeader

Inherits:
Object
  • Object
show all
Defined in:
lib/labimotion/libs/element_variation_header.rb

Overview

ElementVariationHeader Turns an ordered column set into the banded header the React grid draws:

row 1  group      Properties                  | Metadata        | Segments
row 2  sub-group  Conditions                  | Notes | Group   | My Segment
row 3  leaf       Temperature [C] | Solvent   |       |         | Mass [g]

Adjacent columns sharing a header are merged across, and a header with no level beneath it -- the identity columns, and the metadata leaves, which hang straight off their group -- is merged down to the leaf row. That is exactly what ag-grid renders for the same columns.

rows are the three cell arrays; merges the ranges to hand to Axlsx.

Constant Summary collapse

ROWS =
3

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(columns) ⇒ ElementVariationHeader

Returns a new instance of ElementVariationHeader.



22
23
24
# File 'lib/labimotion/libs/element_variation_header.rb', line 22

def initialize(columns)
  @columns = columns
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



26
27
28
# File 'lib/labimotion/libs/element_variation_header.rb', line 26

def columns
  @columns
end

Instance Method Details

#mergesObject



32
33
34
# File 'lib/labimotion/libs/element_variation_header.rb', line 32

def merges
  plan[:merges]
end

#rowsObject



28
29
30
# File 'lib/labimotion/libs/element_variation_header.rb', line 28

def rows
  plan[:rows]
end