Class: DesignSystem::Components::SummaryListRowBuilder
- Inherits:
-
Object
- Object
- DesignSystem::Components::SummaryListRowBuilder
- Defined in:
- lib/design_system/components/summary_list.rb
Instance Attribute Summary collapse
-
#row ⇒ Object
readonly
Returns the value of attribute row.
Instance Method Summary collapse
-
#add_action(content, options = {}) ⇒ Object
Use this method to add an action to a row and add link via options hash.
-
#add_key(content, options = {}) ⇒ Object
Required element for a row in the summary list.
-
#add_value(content, options = {}) ⇒ Object
Use this method to add multiple values in a single row.
-
#initialize ⇒ SummaryListRowBuilder
constructor
A new instance of SummaryListRowBuilder.
Constructor Details
#initialize ⇒ SummaryListRowBuilder
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
#row ⇒ Object (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, = {}) @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, = {}) @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, = {}) @row[:values] << { content: content.to_s, options: } end |