Class: HakumiComponents::Table::DisplayRows
- Inherits:
-
Object
- Object
- HakumiComponents::Table::DisplayRows
- Extended by:
- T::Sig
- Defined in:
- app/components/hakumi_components/table/display_rows.rb
Constant Summary collapse
- Row =
T.type_alias { HakumiComponents::Table::RowRecord }
- DisplayRow =
T.type_alias { { row: Row, depth: Integer } }
- PaginationValue =
T.type_alias { HakumiComponents::Table::Configs::Pagination::Value }
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(rows:, pagination:) ⇒ DisplayRows
constructor
A new instance of DisplayRows.
- #to_a ⇒ Object
Constructor Details
#initialize(rows:, pagination:) ⇒ DisplayRows
Returns a new instance of DisplayRows.
19 20 21 22 |
# File 'app/components/hakumi_components/table/display_rows.rb', line 19 def initialize(rows:, pagination:) @rows = T.let(rows, T::Array[Row]) @pagination = T.let(pagination, PaginationValue) end |
Class Method Details
.build(rows:, pagination:) ⇒ Object
14 15 16 |
# File 'app/components/hakumi_components/table/display_rows.rb', line 14 def self.build(rows:, pagination:) new(rows: rows, pagination: pagination).to_a end |
Instance Method Details
#to_a ⇒ Object
25 26 27 28 |
# File 'app/components/hakumi_components/table/display_rows.rb', line 25 def to_a rows = flatten_tree(@rows) apply_pagination(rows) end |