Class: Promethee::StructureUpgrader::Components::Table
- Inherits:
-
Base
- Object
- Base
- Promethee::StructureUpgrader::Components::Table
show all
- Defined in:
- app/services/promethee/structure_upgrader/components/table.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #upgraded_data
Instance Method Details
#upgrade ⇒ Object
17
18
19
20
21
22
23
24
25
26
|
# File 'app/services/promethee/structure_upgrader/components/table.rb', line 17
def upgrade
@upgraded_data = @data.deep_dup
return if @upgraded_data['attributes'].empty?
attribute('cols').nil? ? generate_cell_matrix_from_data
: generate_cell_matrix_from_structure
@upgraded_data['attributes'] = upgraded_attributes.deep_stringify_keys
@upgraded_data['children'] = @cell_matrix.flatten
end
|
#upgraded_attributes ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'app/services/promethee/structure_upgrader/components/table.rb', line 28
def upgraded_attributes
uuid_matrix = @cell_matrix.map { |row| row.map { |cell| cell['id'] } }
{
'structure' => {
'searchable' => false,
'translatable' => false,
'type' => 'matrix',
'value' => uuid_matrix
}
}
end
|