Class: Polaris::DataTable::ColumnComponent
- Inherits:
-
Component
- Object
- Component
- Polaris::DataTable::ColumnComponent
- Defined in:
- app/components/polaris/data_table/column_component.rb
Constant Summary collapse
- SORT_DEFAULT =
false
- SORT_OPTIONS =
[false, :asc, :desc]
Instance Attribute Summary collapse
-
#numeric ⇒ Object
readonly
Returns the value of attribute numeric.
-
#sort_url ⇒ Object
readonly
Returns the value of attribute sort_url.
-
#sorted ⇒ Object
readonly
Returns the value of attribute sorted.
-
#system_arguments ⇒ Object
readonly
Returns the value of attribute system_arguments.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #call(row) ⇒ Object
-
#initialize(title, numeric: false, total: nil, sorted: SORT_DEFAULT, sort_url: nil, **system_arguments, &block) ⇒ ColumnComponent
constructor
A new instance of ColumnComponent.
Constructor Details
#initialize(title, numeric: false, total: nil, sorted: SORT_DEFAULT, sort_url: nil, **system_arguments, &block) ⇒ ColumnComponent
Returns a new instance of ColumnComponent.
7 8 9 10 11 12 13 14 15 |
# File 'app/components/polaris/data_table/column_component.rb', line 7 def initialize(title, numeric: false, total: nil, sorted: SORT_DEFAULT, sort_url: nil, **system_arguments, &block) @title = title @numeric = numeric @total = total @sorted = fetch_or_fallback(SORT_OPTIONS, sorted, SORT_DEFAULT) @sort_url = sort_url @block = block @system_arguments = system_arguments end |
Instance Attribute Details
#numeric ⇒ Object (readonly)
Returns the value of attribute numeric.
5 6 7 |
# File 'app/components/polaris/data_table/column_component.rb', line 5 def numeric @numeric end |
#sort_url ⇒ Object (readonly)
Returns the value of attribute sort_url.
5 6 7 |
# File 'app/components/polaris/data_table/column_component.rb', line 5 def sort_url @sort_url end |
#sorted ⇒ Object (readonly)
Returns the value of attribute sorted.
5 6 7 |
# File 'app/components/polaris/data_table/column_component.rb', line 5 def sorted @sorted end |
#system_arguments ⇒ Object (readonly)
Returns the value of attribute system_arguments.
5 6 7 |
# File 'app/components/polaris/data_table/column_component.rb', line 5 def system_arguments @system_arguments end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'app/components/polaris/data_table/column_component.rb', line 5 def title @title end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
5 6 7 |
# File 'app/components/polaris/data_table/column_component.rb', line 5 def total @total end |
Instance Method Details
#call(row) ⇒ Object
17 18 19 |
# File 'app/components/polaris/data_table/column_component.rb', line 17 def call(row) @block.call(row) end |