Class: YiffSpace::Utils::TableBuilder
- Inherits:
-
Object
- Object
- YiffSpace::Utils::TableBuilder
- Defined in:
- lib/yiffspace/utils/table_builder.rb
Overview
A helper class for building HTML tables. Used in views.
Defined Under Namespace
Classes: Column
Instance Attribute Summary collapse
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#row_attributes ⇒ Object
readonly
Returns the value of attribute row_attributes.
-
#table_attributes ⇒ Object
readonly
Returns the value of attribute table_attributes.
Instance Method Summary collapse
-
#all_row_attributes(item, _row) ⇒ Hash
Return the HTML attributes for each
tag. - #caption ⇒ Object
Set the table caption.
- #column(**options) ⇒ Object
Add a column to the table.
- #initialize(items, tr: {}, **table_attributes) {|table| ... } ⇒ TableBuilder constructor
Build a table for an array of objects, one object per row.
Constructor Details
#initialize(items, tr: {}, **table_attributes) {|table| ... } ⇒ TableBuilder
Build a table for an array of objects, one object per row.
The
tag is automatically given an HTML id of the form
{name}-table. For example,posts-table,tags-table.The
tag is automatically given an HTML id of the form {name}-{id}. For example,post-1234,tag-4567, etc. Eachtag also gets a set of data attributes for each model; see #html_data_attributes in app/policies. - #caption ⇒ Object