Class: DesignSystem::Components::SummaryList
- Inherits:
-
Object
- Object
- DesignSystem::Components::SummaryList
- Defined in:
- lib/design_system/components/summary_list.rb
Instance Attribute Summary collapse
-
#rows ⇒ Object
Returns the value of attribute rows.
Instance Method Summary collapse
-
#add_row(*args, key: nil, value: nil) {|row_builder| ... } ⇒ Object
Add a new row to the summary list.
-
#initialize ⇒ SummaryList
constructor
A new instance of SummaryList.
Constructor Details
#initialize ⇒ SummaryList
Returns a new instance of SummaryList.
8 9 10 |
# File 'lib/design_system/components/summary_list.rb', line 8 def initialize @rows = [] end |
Instance Attribute Details
#rows ⇒ Object
Returns the value of attribute rows.
6 7 8 |
# File 'lib/design_system/components/summary_list.rb', line 6 def rows @rows end |
Instance Method Details
#add_row(*args, key: nil, value: nil) {|row_builder| ... } ⇒ Object
Add a new row to the summary list. Use this method to add rows containing single key-value pair
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/design_system/components/summary_list.rb', line 14 def add_row(*args, key: nil, value: nil) key, value = args if args.any? row_builder = SummaryListRowBuilder.new row_builder.add_key(key) if key row_builder.add_value(value) if value yield(row_builder) if block_given? @rows << row_builder.row end |