Class: DesignSystem::Components::SummaryListRowBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/design_system/components/summary_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSummaryListRowBuilder

Returns a new instance of SummaryListRowBuilder.



29
30
31
32
33
34
35
# File 'lib/design_system/components/summary_list.rb', line 29

def initialize
  @row = {
    key: {},
    values: [],
    actions: []
  }
end

Instance Attribute Details

#rowObject (readonly)

Returns the value of attribute row.



27
28
29
# File 'lib/design_system/components/summary_list.rb', line 27

def row
  @row
end

Instance Method Details

#add_action(content, options = {}) ⇒ Object

Use this method to add an action to a row and add link via options hash



48
49
50
# File 'lib/design_system/components/summary_list.rb', line 48

def add_action(content, options = {})
  @row[:actions] << { content: content.to_s, options: }
end

#add_key(content, options = {}) ⇒ Object

Required element for a row in the summary list



38
39
40
# File 'lib/design_system/components/summary_list.rb', line 38

def add_key(content, options = {})
  @row[:key] = { content: content.to_s, options: }
end

#add_value(content, options = {}) ⇒ Object

Use this method to add multiple values in a single row



43
44
45
# File 'lib/design_system/components/summary_list.rb', line 43

def add_value(content, options = {})
  @row[:values] << { content: content.to_s, options: }
end